Numeric.SpecFunctions:logBeta from math-functions-0.1.5.2, A

Percentage Accurate: 99.8% → 99.8%
Time: 4.8s
Alternatives: 16
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ \left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (+ (- (+ (+ x y) z) (* z (log t))) (* (- a 0.5) b)))
double code(double x, double y, double z, double t, double a, double b) {
	return (((x + y) + z) - (z * log(t))) + ((a - 0.5) * 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(x, y, z, t, a, b)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    code = (((x + y) + z) - (z * log(t))) + ((a - 0.5d0) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	return (((x + y) + z) - (z * Math.log(t))) + ((a - 0.5) * b);
}
def code(x, y, z, t, a, b):
	return (((x + y) + z) - (z * math.log(t))) + ((a - 0.5) * b)
function code(x, y, z, t, a, b)
	return Float64(Float64(Float64(Float64(x + y) + z) - Float64(z * log(t))) + Float64(Float64(a - 0.5) * b))
end
function tmp = code(x, y, z, t, a, b)
	tmp = (((x + y) + z) - (z * log(t))) + ((a - 0.5) * b);
end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(N[(x + y), $MachinePrecision] + z), $MachinePrecision] - N[(z * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b
\end{array}

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 16 alternatives:

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

Initial Program: 99.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (+ (- (+ (+ x y) z) (* z (log t))) (* (- a 0.5) b)))
double code(double x, double y, double z, double t, double a, double b) {
	return (((x + y) + z) - (z * log(t))) + ((a - 0.5) * 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(x, y, z, t, a, b)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    code = (((x + y) + z) - (z * log(t))) + ((a - 0.5d0) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	return (((x + y) + z) - (z * Math.log(t))) + ((a - 0.5) * b);
}
def code(x, y, z, t, a, b):
	return (((x + y) + z) - (z * math.log(t))) + ((a - 0.5) * b)
function code(x, y, z, t, a, b)
	return Float64(Float64(Float64(Float64(x + y) + z) - Float64(z * log(t))) + Float64(Float64(a - 0.5) * b))
end
function tmp = code(x, y, z, t, a, b)
	tmp = (((x + y) + z) - (z * log(t))) + ((a - 0.5) * b);
end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(N[(x + y), $MachinePrecision] + z), $MachinePrecision] - N[(z * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b
\end{array}

Alternative 1: 99.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (+ (- (+ (+ x y) z) (* z (log t))) (* (- a 0.5) b)))
double code(double x, double y, double z, double t, double a, double b) {
	return (((x + y) + z) - (z * log(t))) + ((a - 0.5) * 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(x, y, z, t, a, b)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    code = (((x + y) + z) - (z * log(t))) + ((a - 0.5d0) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	return (((x + y) + z) - (z * Math.log(t))) + ((a - 0.5) * b);
}
def code(x, y, z, t, a, b):
	return (((x + y) + z) - (z * math.log(t))) + ((a - 0.5) * b)
function code(x, y, z, t, a, b)
	return Float64(Float64(Float64(Float64(x + y) + z) - Float64(z * log(t))) + Float64(Float64(a - 0.5) * b))
end
function tmp = code(x, y, z, t, a, b)
	tmp = (((x + y) + z) - (z * log(t))) + ((a - 0.5) * b);
end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(N[(x + y), $MachinePrecision] + z), $MachinePrecision] - N[(z * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b
\end{array}
Derivation
  1. Initial program 99.8%

    \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
  2. Add Preprocessing

Alternative 2: 90.6% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(a - 0.5\right) \cdot b\\ t_2 := \mathsf{fma}\left(a - 0.5, b, y\right) + x\\ \mathbf{if}\;t\_1 \leq -1 \cdot 10^{+82}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+78}:\\ \;\;\;\;\left(\left(y + x\right) + z\right) - \log t \cdot z\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (* (- a 0.5) b)) (t_2 (+ (fma (- a 0.5) b y) x)))
   (if (<= t_1 -1e+82)
     t_2
     (if (<= t_1 5e+78) (- (+ (+ y x) z) (* (log t) z)) t_2))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = (a - 0.5) * b;
	double t_2 = fma((a - 0.5), b, y) + x;
	double tmp;
	if (t_1 <= -1e+82) {
		tmp = t_2;
	} else if (t_1 <= 5e+78) {
		tmp = ((y + x) + z) - (log(t) * z);
	} else {
		tmp = t_2;
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	t_1 = Float64(Float64(a - 0.5) * b)
	t_2 = Float64(fma(Float64(a - 0.5), b, y) + x)
	tmp = 0.0
	if (t_1 <= -1e+82)
		tmp = t_2;
	elseif (t_1 <= 5e+78)
		tmp = Float64(Float64(Float64(y + x) + z) - Float64(log(t) * z));
	else
		tmp = t_2;
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(a - 0.5), $MachinePrecision] * b + y), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+82], t$95$2, If[LessEqual[t$95$1, 5e+78], N[(N[(N[(y + x), $MachinePrecision] + z), $MachinePrecision] - N[(N[Log[t], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left(a - 0.5\right) \cdot b\\
t_2 := \mathsf{fma}\left(a - 0.5, b, y\right) + x\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+82}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+78}:\\
\;\;\;\;\left(\left(y + x\right) + z\right) - \log t \cdot z\\

\mathbf{else}:\\
\;\;\;\;t\_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < -9.9999999999999996e81 or 4.99999999999999984e78 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b)

    1. Initial program 99.9%

      \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
    2. Taylor expanded in z around 0

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(a - \frac{1}{2}, b, y\right) + x \]
      6. lift--.f6488.4

        \[\leadsto \mathsf{fma}\left(a - 0.5, b, y\right) + x \]
    4. Applied rewrites88.4%

      \[\leadsto \color{blue}{\mathsf{fma}\left(a - 0.5, b, y\right) + x} \]

    if -9.9999999999999996e81 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < 4.99999999999999984e78

    1. Initial program 99.8%

      \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
    2. Taylor expanded in b around 0

      \[\leadsto \color{blue}{\left(x + \left(y + z\right)\right) - z \cdot \log t} \]
    3. Step-by-step derivation
      1. associate-+r+N/A

        \[\leadsto \left(\left(x + y\right) + z\right) - \color{blue}{z} \cdot \log t \]
      2. lower--.f64N/A

        \[\leadsto \left(\left(x + y\right) + z\right) - \color{blue}{z \cdot \log t} \]
      3. lift-+.f64N/A

        \[\leadsto \left(\left(x + y\right) + z\right) - \color{blue}{z} \cdot \log t \]
      4. +-commutativeN/A

        \[\leadsto \left(\left(y + x\right) + z\right) - z \cdot \log t \]
      5. lower-+.f64N/A

        \[\leadsto \left(\left(y + x\right) + z\right) - z \cdot \log t \]
      6. *-commutativeN/A

        \[\leadsto \left(\left(y + x\right) + z\right) - \log t \cdot \color{blue}{z} \]
      7. lower-*.f64N/A

        \[\leadsto \left(\left(y + x\right) + z\right) - \log t \cdot \color{blue}{z} \]
      8. lift-log.f6492.7

        \[\leadsto \left(\left(y + x\right) + z\right) - \log t \cdot z \]
    4. Applied rewrites92.7%

      \[\leadsto \color{blue}{\left(\left(y + x\right) + z\right) - \log t \cdot z} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 3: 85.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \mathsf{fma}\left(a, b, \left(1 - \log t\right) \cdot z\right)\\ \mathbf{if}\;z \leq -8.5 \cdot 10^{+182}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 8.5 \cdot 10^{+251}:\\ \;\;\;\;\mathsf{fma}\left(a - 0.5, b, y\right) + x\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (fma a b (* (- 1.0 (log t)) z))))
   (if (<= z -8.5e+182)
     t_1
     (if (<= z 8.5e+251) (+ (fma (- a 0.5) b y) x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = fma(a, b, ((1.0 - log(t)) * z));
	double tmp;
	if (z <= -8.5e+182) {
		tmp = t_1;
	} else if (z <= 8.5e+251) {
		tmp = fma((a - 0.5), b, y) + x;
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	t_1 = fma(a, b, Float64(Float64(1.0 - log(t)) * z))
	tmp = 0.0
	if (z <= -8.5e+182)
		tmp = t_1;
	elseif (z <= 8.5e+251)
		tmp = Float64(fma(Float64(a - 0.5), b, y) + x);
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(a * b + N[(N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -8.5e+182], t$95$1, If[LessEqual[z, 8.5e+251], N[(N[(N[(a - 0.5), $MachinePrecision] * b + y), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(a, b, \left(1 - \log t\right) \cdot z\right)\\
\mathbf{if}\;z \leq -8.5 \cdot 10^{+182}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq 8.5 \cdot 10^{+251}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, b, y\right) + x\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -8.5e182 or 8.5e251 < z

    1. Initial program 99.5%

      \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
    2. Taylor expanded in x around inf

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

        \[\leadsto \color{blue}{x} + \left(a - 0.5\right) \cdot b \]
      2. Taylor expanded in a around inf

        \[\leadsto x + \color{blue}{a} \cdot b \]
      3. Step-by-step derivation
        1. Applied rewrites22.6%

          \[\leadsto x + \color{blue}{a} \cdot b \]
        2. Taylor expanded in z around inf

          \[\leadsto \color{blue}{z \cdot \left(1 - \log t\right)} + a \cdot b \]
        3. Step-by-step derivation
          1. *-commutativeN/A

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

            \[\leadsto \left(1 - \log t\right) \cdot \color{blue}{z} + a \cdot b \]
          3. lower--.f64N/A

            \[\leadsto \left(1 - \log t\right) \cdot z + a \cdot b \]
          4. lift-log.f6480.8

            \[\leadsto \left(1 - \log t\right) \cdot z + a \cdot b \]
        4. Applied rewrites80.8%

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

            \[\leadsto \color{blue}{\left(1 - \log t\right) \cdot z + a \cdot b} \]
          2. +-commutativeN/A

            \[\leadsto \color{blue}{a \cdot b + \left(1 - \log t\right) \cdot z} \]
          3. lift-*.f64N/A

            \[\leadsto \color{blue}{a \cdot b} + \left(1 - \log t\right) \cdot z \]
          4. lower-fma.f6480.8

            \[\leadsto \color{blue}{\mathsf{fma}\left(a, b, \left(1 - \log t\right) \cdot z\right)} \]
        6. Applied rewrites80.8%

          \[\leadsto \color{blue}{\mathsf{fma}\left(a, b, \left(1 - \log t\right) \cdot z\right)} \]

        if -8.5e182 < z < 8.5e251

        1. Initial program 99.9%

          \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
        2. Taylor expanded in z around 0

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

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

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

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

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

            \[\leadsto \mathsf{fma}\left(a - \frac{1}{2}, b, y\right) + x \]
          6. lift--.f6486.7

            \[\leadsto \mathsf{fma}\left(a - 0.5, b, y\right) + x \]
        4. Applied rewrites86.7%

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

      Alternative 4: 83.7% accurate, 1.3× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(1 - \log t\right) \cdot z\\ \mathbf{if}\;z \leq -9.6 \cdot 10^{+182}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 6.6 \cdot 10^{+255}:\\ \;\;\;\;\mathsf{fma}\left(a - 0.5, b, y\right) + x\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
      (FPCore (x y z t a b)
       :precision binary64
       (let* ((t_1 (* (- 1.0 (log t)) z)))
         (if (<= z -9.6e+182)
           t_1
           (if (<= z 6.6e+255) (+ (fma (- a 0.5) b y) x) t_1))))
      double code(double x, double y, double z, double t, double a, double b) {
      	double t_1 = (1.0 - log(t)) * z;
      	double tmp;
      	if (z <= -9.6e+182) {
      		tmp = t_1;
      	} else if (z <= 6.6e+255) {
      		tmp = fma((a - 0.5), b, y) + x;
      	} else {
      		tmp = t_1;
      	}
      	return tmp;
      }
      
      function code(x, y, z, t, a, b)
      	t_1 = Float64(Float64(1.0 - log(t)) * z)
      	tmp = 0.0
      	if (z <= -9.6e+182)
      		tmp = t_1;
      	elseif (z <= 6.6e+255)
      		tmp = Float64(fma(Float64(a - 0.5), b, y) + x);
      	else
      		tmp = t_1;
      	end
      	return tmp
      end
      
      code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -9.6e+182], t$95$1, If[LessEqual[z, 6.6e+255], N[(N[(N[(a - 0.5), $MachinePrecision] * b + y), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_1 := \left(1 - \log t\right) \cdot z\\
      \mathbf{if}\;z \leq -9.6 \cdot 10^{+182}:\\
      \;\;\;\;t\_1\\
      
      \mathbf{elif}\;z \leq 6.6 \cdot 10^{+255}:\\
      \;\;\;\;\mathsf{fma}\left(a - 0.5, b, y\right) + x\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_1\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if z < -9.60000000000000038e182 or 6.59999999999999963e255 < z

        1. Initial program 99.5%

          \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
        2. Taylor expanded in z around inf

          \[\leadsto \color{blue}{z \cdot \left(1 - \log t\right)} \]
        3. Step-by-step derivation
          1. *-commutativeN/A

            \[\leadsto \left(1 - \log t\right) \cdot \color{blue}{z} \]
          2. lower-*.f64N/A

            \[\leadsto \left(1 - \log t\right) \cdot \color{blue}{z} \]
          3. lower--.f64N/A

            \[\leadsto \left(1 - \log t\right) \cdot z \]
          4. lift-log.f6467.2

            \[\leadsto \left(1 - \log t\right) \cdot z \]
        4. Applied rewrites67.2%

          \[\leadsto \color{blue}{\left(1 - \log t\right) \cdot z} \]

        if -9.60000000000000038e182 < z < 6.59999999999999963e255

        1. Initial program 99.9%

          \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
        2. Taylor expanded in z around 0

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

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

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

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

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

            \[\leadsto \mathsf{fma}\left(a - \frac{1}{2}, b, y\right) + x \]
          6. lift--.f6486.4

            \[\leadsto \mathsf{fma}\left(a - 0.5, b, y\right) + x \]
        4. Applied rewrites86.4%

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

      Alternative 5: 78.8% accurate, 2.3× speedup?

      \[\begin{array}{l} \\ \mathsf{fma}\left(a - 0.5, b, y\right) + x \end{array} \]
      (FPCore (x y z t a b) :precision binary64 (+ (fma (- a 0.5) b y) x))
      double code(double x, double y, double z, double t, double a, double b) {
      	return fma((a - 0.5), b, y) + x;
      }
      
      function code(x, y, z, t, a, b)
      	return Float64(fma(Float64(a - 0.5), b, y) + x)
      end
      
      code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(a - 0.5), $MachinePrecision] * b + y), $MachinePrecision] + x), $MachinePrecision]
      
      \begin{array}{l}
      
      \\
      \mathsf{fma}\left(a - 0.5, b, y\right) + x
      \end{array}
      
      Derivation
      1. Initial program 99.8%

        \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
      2. Taylor expanded in z around 0

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(a - \frac{1}{2}, b, y\right) + x \]
        6. lift--.f6478.8

          \[\leadsto \mathsf{fma}\left(a - 0.5, b, y\right) + x \]
      4. Applied rewrites78.8%

        \[\leadsto \color{blue}{\mathsf{fma}\left(a - 0.5, b, y\right) + x} \]
      5. Add Preprocessing

      Alternative 6: 59.1% accurate, 0.9× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\left(\left(x + y\right) + z\right) - z \cdot \log t \leq -1 \cdot 10^{-58}:\\ \;\;\;\;x + \left(a - 0.5\right) \cdot b\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(b, a - 0.5, y\right)\\ \end{array} \end{array} \]
      (FPCore (x y z t a b)
       :precision binary64
       (if (<= (- (+ (+ x y) z) (* z (log t))) -1e-58)
         (+ x (* (- a 0.5) b))
         (fma b (- a 0.5) y)))
      double code(double x, double y, double z, double t, double a, double b) {
      	double tmp;
      	if ((((x + y) + z) - (z * log(t))) <= -1e-58) {
      		tmp = x + ((a - 0.5) * b);
      	} else {
      		tmp = fma(b, (a - 0.5), y);
      	}
      	return tmp;
      }
      
      function code(x, y, z, t, a, b)
      	tmp = 0.0
      	if (Float64(Float64(Float64(x + y) + z) - Float64(z * log(t))) <= -1e-58)
      		tmp = Float64(x + Float64(Float64(a - 0.5) * b));
      	else
      		tmp = fma(b, Float64(a - 0.5), y);
      	end
      	return tmp
      end
      
      code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(N[(N[(x + y), $MachinePrecision] + z), $MachinePrecision] - N[(z * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1e-58], N[(x + N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], N[(b * N[(a - 0.5), $MachinePrecision] + y), $MachinePrecision]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;\left(\left(x + y\right) + z\right) - z \cdot \log t \leq -1 \cdot 10^{-58}:\\
      \;\;\;\;x + \left(a - 0.5\right) \cdot b\\
      
      \mathbf{else}:\\
      \;\;\;\;\mathsf{fma}\left(b, a - 0.5, y\right)\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if (-.f64 (+.f64 (+.f64 x y) z) (*.f64 z (log.f64 t))) < -1e-58

        1. Initial program 99.8%

          \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
        2. Taylor expanded in x around inf

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

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

          if -1e-58 < (-.f64 (+.f64 (+.f64 x y) z) (*.f64 z (log.f64 t)))

          1. Initial program 99.9%

            \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
          2. Taylor expanded in z around 0

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

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

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

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

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

              \[\leadsto \mathsf{fma}\left(a - \frac{1}{2}, b, y\right) + x \]
            6. lift--.f6479.8

              \[\leadsto \mathsf{fma}\left(a - 0.5, b, y\right) + x \]
          4. Applied rewrites79.8%

            \[\leadsto \color{blue}{\mathsf{fma}\left(a - 0.5, b, y\right) + x} \]
          5. Taylor expanded in x around 0

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

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

              \[\leadsto \mathsf{fma}\left(b, a - \color{blue}{\frac{1}{2}}, y\right) \]
            3. lift--.f6459.8

              \[\leadsto \mathsf{fma}\left(b, a - 0.5, y\right) \]
          7. Applied rewrites59.8%

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

        Alternative 7: 58.0% accurate, 0.5× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(\left(x + y\right) + z\right) - z \cdot \log t\\ \mathbf{if}\;t\_1 \leq -5 \cdot 10^{+127}:\\ \;\;\;\;\mathsf{fma}\left(a, b, x\right)\\ \mathbf{elif}\;t\_1 \leq -1 \cdot 10^{+60}:\\ \;\;\;\;x + -0.5 \cdot b\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(b, a - 0.5, y\right)\\ \end{array} \end{array} \]
        (FPCore (x y z t a b)
         :precision binary64
         (let* ((t_1 (- (+ (+ x y) z) (* z (log t)))))
           (if (<= t_1 -5e+127)
             (fma a b x)
             (if (<= t_1 -1e+60) (+ x (* -0.5 b)) (fma b (- a 0.5) y)))))
        double code(double x, double y, double z, double t, double a, double b) {
        	double t_1 = ((x + y) + z) - (z * log(t));
        	double tmp;
        	if (t_1 <= -5e+127) {
        		tmp = fma(a, b, x);
        	} else if (t_1 <= -1e+60) {
        		tmp = x + (-0.5 * b);
        	} else {
        		tmp = fma(b, (a - 0.5), y);
        	}
        	return tmp;
        }
        
        function code(x, y, z, t, a, b)
        	t_1 = Float64(Float64(Float64(x + y) + z) - Float64(z * log(t)))
        	tmp = 0.0
        	if (t_1 <= -5e+127)
        		tmp = fma(a, b, x);
        	elseif (t_1 <= -1e+60)
        		tmp = Float64(x + Float64(-0.5 * b));
        	else
        		tmp = fma(b, Float64(a - 0.5), y);
        	end
        	return tmp
        end
        
        code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(x + y), $MachinePrecision] + z), $MachinePrecision] - N[(z * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+127], N[(a * b + x), $MachinePrecision], If[LessEqual[t$95$1, -1e+60], N[(x + N[(-0.5 * b), $MachinePrecision]), $MachinePrecision], N[(b * N[(a - 0.5), $MachinePrecision] + y), $MachinePrecision]]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_1 := \left(\left(x + y\right) + z\right) - z \cdot \log t\\
        \mathbf{if}\;t\_1 \leq -5 \cdot 10^{+127}:\\
        \;\;\;\;\mathsf{fma}\left(a, b, x\right)\\
        
        \mathbf{elif}\;t\_1 \leq -1 \cdot 10^{+60}:\\
        \;\;\;\;x + -0.5 \cdot b\\
        
        \mathbf{else}:\\
        \;\;\;\;\mathsf{fma}\left(b, a - 0.5, y\right)\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if (-.f64 (+.f64 (+.f64 x y) z) (*.f64 z (log.f64 t))) < -5.0000000000000004e127

          1. Initial program 99.8%

            \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
          2. Taylor expanded in x around inf

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

              \[\leadsto \color{blue}{x} + \left(a - 0.5\right) \cdot b \]
            2. Taylor expanded in a around inf

              \[\leadsto x + \color{blue}{a} \cdot b \]
            3. Step-by-step derivation
              1. Applied rewrites43.8%

                \[\leadsto x + \color{blue}{a} \cdot b \]
              2. Step-by-step derivation
                1. lift-+.f64N/A

                  \[\leadsto \color{blue}{x + a \cdot b} \]
                2. +-commutativeN/A

                  \[\leadsto \color{blue}{a \cdot b + x} \]
                3. lift-*.f64N/A

                  \[\leadsto \color{blue}{a \cdot b} + x \]
                4. lower-fma.f6443.8

                  \[\leadsto \color{blue}{\mathsf{fma}\left(a, b, x\right)} \]
              3. Applied rewrites43.8%

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

              if -5.0000000000000004e127 < (-.f64 (+.f64 (+.f64 x y) z) (*.f64 z (log.f64 t))) < -9.9999999999999995e59

              1. Initial program 99.9%

                \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
              2. Taylor expanded in x around inf

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

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

                  \[\leadsto x + \color{blue}{\frac{-1}{2}} \cdot b \]
                3. Step-by-step derivation
                  1. Applied rewrites35.3%

                    \[\leadsto x + \color{blue}{-0.5} \cdot b \]

                  if -9.9999999999999995e59 < (-.f64 (+.f64 (+.f64 x y) z) (*.f64 z (log.f64 t)))

                  1. Initial program 99.9%

                    \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
                  2. Taylor expanded in z around 0

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

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

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

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

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

                      \[\leadsto \mathsf{fma}\left(a - \frac{1}{2}, b, y\right) + x \]
                    6. lift--.f6480.5

                      \[\leadsto \mathsf{fma}\left(a - 0.5, b, y\right) + x \]
                  4. Applied rewrites80.5%

                    \[\leadsto \color{blue}{\mathsf{fma}\left(a - 0.5, b, y\right) + x} \]
                  5. Taylor expanded in x around 0

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

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

                      \[\leadsto \mathsf{fma}\left(b, a - \color{blue}{\frac{1}{2}}, y\right) \]
                    3. lift--.f6461.2

                      \[\leadsto \mathsf{fma}\left(b, a - 0.5, y\right) \]
                  7. Applied rewrites61.2%

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

                Alternative 8: 57.8% accurate, 1.3× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x + y \leq -5 \cdot 10^{+27}:\\ \;\;\;\;x + -0.5 \cdot b\\ \mathbf{elif}\;x + y \leq 150000000:\\ \;\;\;\;\left(a - 0.5\right) \cdot b\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(a, b, y\right)\\ \end{array} \end{array} \]
                (FPCore (x y z t a b)
                 :precision binary64
                 (if (<= (+ x y) -5e+27)
                   (+ x (* -0.5 b))
                   (if (<= (+ x y) 150000000.0) (* (- a 0.5) b) (fma a b y))))
                double code(double x, double y, double z, double t, double a, double b) {
                	double tmp;
                	if ((x + y) <= -5e+27) {
                		tmp = x + (-0.5 * b);
                	} else if ((x + y) <= 150000000.0) {
                		tmp = (a - 0.5) * b;
                	} else {
                		tmp = fma(a, b, y);
                	}
                	return tmp;
                }
                
                function code(x, y, z, t, a, b)
                	tmp = 0.0
                	if (Float64(x + y) <= -5e+27)
                		tmp = Float64(x + Float64(-0.5 * b));
                	elseif (Float64(x + y) <= 150000000.0)
                		tmp = Float64(Float64(a - 0.5) * b);
                	else
                		tmp = fma(a, b, y);
                	end
                	return tmp
                end
                
                code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(x + y), $MachinePrecision], -5e+27], N[(x + N[(-0.5 * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x + y), $MachinePrecision], 150000000.0], N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision], N[(a * b + y), $MachinePrecision]]]
                
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                \mathbf{if}\;x + y \leq -5 \cdot 10^{+27}:\\
                \;\;\;\;x + -0.5 \cdot b\\
                
                \mathbf{elif}\;x + y \leq 150000000:\\
                \;\;\;\;\left(a - 0.5\right) \cdot b\\
                
                \mathbf{else}:\\
                \;\;\;\;\mathsf{fma}\left(a, b, y\right)\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 3 regimes
                2. if (+.f64 x y) < -4.99999999999999979e27

                  1. Initial program 99.9%

                    \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
                  2. Taylor expanded in x around inf

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

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

                      \[\leadsto x + \color{blue}{\frac{-1}{2}} \cdot b \]
                    3. Step-by-step derivation
                      1. Applied rewrites36.5%

                        \[\leadsto x + \color{blue}{-0.5} \cdot b \]

                      if -4.99999999999999979e27 < (+.f64 x y) < 1.5e8

                      1. Initial program 99.7%

                        \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
                      2. Taylor expanded in b around inf

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

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

                          \[\leadsto \left(a - \frac{1}{2}\right) \cdot b \]
                        3. lift-*.f6455.1

                          \[\leadsto \left(a - 0.5\right) \cdot \color{blue}{b} \]
                      4. Applied rewrites55.1%

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

                      if 1.5e8 < (+.f64 x y)

                      1. Initial program 99.9%

                        \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
                      2. Taylor expanded in x around inf

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

                          \[\leadsto \color{blue}{x} + \left(a - 0.5\right) \cdot b \]
                        2. Taylor expanded in a around inf

                          \[\leadsto x + \color{blue}{a} \cdot b \]
                        3. Step-by-step derivation
                          1. Applied rewrites49.2%

                            \[\leadsto x + \color{blue}{a} \cdot b \]
                          2. Taylor expanded in y around inf

                            \[\leadsto \color{blue}{y} + a \cdot b \]
                          3. Step-by-step derivation
                            1. Applied rewrites48.1%

                              \[\leadsto \color{blue}{y} + a \cdot b \]
                            2. Step-by-step derivation
                              1. lift-+.f64N/A

                                \[\leadsto \color{blue}{y + a \cdot b} \]
                              2. +-commutativeN/A

                                \[\leadsto \color{blue}{a \cdot b + y} \]
                              3. lift-*.f64N/A

                                \[\leadsto \color{blue}{a \cdot b} + y \]
                              4. lower-fma.f6448.1

                                \[\leadsto \color{blue}{\mathsf{fma}\left(a, b, y\right)} \]
                            3. Applied rewrites48.1%

                              \[\leadsto \color{blue}{\mathsf{fma}\left(a, b, y\right)} \]
                          4. Recombined 3 regimes into one program.
                          5. Add Preprocessing

                          Alternative 9: 57.5% accurate, 1.3× speedup?

                          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x + y \leq -5 \cdot 10^{+106}:\\ \;\;\;\;\mathsf{fma}\left(a, b, x\right)\\ \mathbf{elif}\;x + y \leq 150000000:\\ \;\;\;\;\left(a - 0.5\right) \cdot b\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(a, b, y\right)\\ \end{array} \end{array} \]
                          (FPCore (x y z t a b)
                           :precision binary64
                           (if (<= (+ x y) -5e+106)
                             (fma a b x)
                             (if (<= (+ x y) 150000000.0) (* (- a 0.5) b) (fma a b y))))
                          double code(double x, double y, double z, double t, double a, double b) {
                          	double tmp;
                          	if ((x + y) <= -5e+106) {
                          		tmp = fma(a, b, x);
                          	} else if ((x + y) <= 150000000.0) {
                          		tmp = (a - 0.5) * b;
                          	} else {
                          		tmp = fma(a, b, y);
                          	}
                          	return tmp;
                          }
                          
                          function code(x, y, z, t, a, b)
                          	tmp = 0.0
                          	if (Float64(x + y) <= -5e+106)
                          		tmp = fma(a, b, x);
                          	elseif (Float64(x + y) <= 150000000.0)
                          		tmp = Float64(Float64(a - 0.5) * b);
                          	else
                          		tmp = fma(a, b, y);
                          	end
                          	return tmp
                          end
                          
                          code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(x + y), $MachinePrecision], -5e+106], N[(a * b + x), $MachinePrecision], If[LessEqual[N[(x + y), $MachinePrecision], 150000000.0], N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision], N[(a * b + y), $MachinePrecision]]]
                          
                          \begin{array}{l}
                          
                          \\
                          \begin{array}{l}
                          \mathbf{if}\;x + y \leq -5 \cdot 10^{+106}:\\
                          \;\;\;\;\mathsf{fma}\left(a, b, x\right)\\
                          
                          \mathbf{elif}\;x + y \leq 150000000:\\
                          \;\;\;\;\left(a - 0.5\right) \cdot b\\
                          
                          \mathbf{else}:\\
                          \;\;\;\;\mathsf{fma}\left(a, b, y\right)\\
                          
                          
                          \end{array}
                          \end{array}
                          
                          Derivation
                          1. Split input into 3 regimes
                          2. if (+.f64 x y) < -4.9999999999999998e106

                            1. Initial program 99.9%

                              \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
                            2. Taylor expanded in x around inf

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

                                \[\leadsto \color{blue}{x} + \left(a - 0.5\right) \cdot b \]
                              2. Taylor expanded in a around inf

                                \[\leadsto x + \color{blue}{a} \cdot b \]
                              3. Step-by-step derivation
                                1. Applied rewrites49.4%

                                  \[\leadsto x + \color{blue}{a} \cdot b \]
                                2. Step-by-step derivation
                                  1. lift-+.f64N/A

                                    \[\leadsto \color{blue}{x + a \cdot b} \]
                                  2. +-commutativeN/A

                                    \[\leadsto \color{blue}{a \cdot b + x} \]
                                  3. lift-*.f64N/A

                                    \[\leadsto \color{blue}{a \cdot b} + x \]
                                  4. lower-fma.f6449.4

                                    \[\leadsto \color{blue}{\mathsf{fma}\left(a, b, x\right)} \]
                                3. Applied rewrites49.4%

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

                                if -4.9999999999999998e106 < (+.f64 x y) < 1.5e8

                                1. Initial program 99.7%

                                  \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
                                2. Taylor expanded in b around inf

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

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

                                    \[\leadsto \left(a - \frac{1}{2}\right) \cdot b \]
                                  3. lift-*.f6452.7

                                    \[\leadsto \left(a - 0.5\right) \cdot \color{blue}{b} \]
                                4. Applied rewrites52.7%

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

                                if 1.5e8 < (+.f64 x y)

                                1. Initial program 99.9%

                                  \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
                                2. Taylor expanded in x around inf

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

                                    \[\leadsto \color{blue}{x} + \left(a - 0.5\right) \cdot b \]
                                  2. Taylor expanded in a around inf

                                    \[\leadsto x + \color{blue}{a} \cdot b \]
                                  3. Step-by-step derivation
                                    1. Applied rewrites49.2%

                                      \[\leadsto x + \color{blue}{a} \cdot b \]
                                    2. Taylor expanded in y around inf

                                      \[\leadsto \color{blue}{y} + a \cdot b \]
                                    3. Step-by-step derivation
                                      1. Applied rewrites48.1%

                                        \[\leadsto \color{blue}{y} + a \cdot b \]
                                      2. Step-by-step derivation
                                        1. lift-+.f64N/A

                                          \[\leadsto \color{blue}{y + a \cdot b} \]
                                        2. +-commutativeN/A

                                          \[\leadsto \color{blue}{a \cdot b + y} \]
                                        3. lift-*.f64N/A

                                          \[\leadsto \color{blue}{a \cdot b} + y \]
                                        4. lower-fma.f6448.1

                                          \[\leadsto \color{blue}{\mathsf{fma}\left(a, b, y\right)} \]
                                      3. Applied rewrites48.1%

                                        \[\leadsto \color{blue}{\mathsf{fma}\left(a, b, y\right)} \]
                                    4. Recombined 3 regimes into one program.
                                    5. Add Preprocessing

                                    Alternative 10: 53.5% accurate, 1.4× speedup?

                                    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x + y \leq -0.0002:\\ \;\;\;\;\mathsf{fma}\left(a, b, x\right)\\ \mathbf{elif}\;x + y \leq -1 \cdot 10^{-53}:\\ \;\;\;\;-0.5 \cdot b\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(a, b, y\right)\\ \end{array} \end{array} \]
                                    (FPCore (x y z t a b)
                                     :precision binary64
                                     (if (<= (+ x y) -0.0002)
                                       (fma a b x)
                                       (if (<= (+ x y) -1e-53) (* -0.5 b) (fma a b y))))
                                    double code(double x, double y, double z, double t, double a, double b) {
                                    	double tmp;
                                    	if ((x + y) <= -0.0002) {
                                    		tmp = fma(a, b, x);
                                    	} else if ((x + y) <= -1e-53) {
                                    		tmp = -0.5 * b;
                                    	} else {
                                    		tmp = fma(a, b, y);
                                    	}
                                    	return tmp;
                                    }
                                    
                                    function code(x, y, z, t, a, b)
                                    	tmp = 0.0
                                    	if (Float64(x + y) <= -0.0002)
                                    		tmp = fma(a, b, x);
                                    	elseif (Float64(x + y) <= -1e-53)
                                    		tmp = Float64(-0.5 * b);
                                    	else
                                    		tmp = fma(a, b, y);
                                    	end
                                    	return tmp
                                    end
                                    
                                    code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(x + y), $MachinePrecision], -0.0002], N[(a * b + x), $MachinePrecision], If[LessEqual[N[(x + y), $MachinePrecision], -1e-53], N[(-0.5 * b), $MachinePrecision], N[(a * b + y), $MachinePrecision]]]
                                    
                                    \begin{array}{l}
                                    
                                    \\
                                    \begin{array}{l}
                                    \mathbf{if}\;x + y \leq -0.0002:\\
                                    \;\;\;\;\mathsf{fma}\left(a, b, x\right)\\
                                    
                                    \mathbf{elif}\;x + y \leq -1 \cdot 10^{-53}:\\
                                    \;\;\;\;-0.5 \cdot b\\
                                    
                                    \mathbf{else}:\\
                                    \;\;\;\;\mathsf{fma}\left(a, b, y\right)\\
                                    
                                    
                                    \end{array}
                                    \end{array}
                                    
                                    Derivation
                                    1. Split input into 3 regimes
                                    2. if (+.f64 x y) < -2.0000000000000001e-4

                                      1. Initial program 99.9%

                                        \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
                                      2. Taylor expanded in x around inf

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

                                          \[\leadsto \color{blue}{x} + \left(a - 0.5\right) \cdot b \]
                                        2. Taylor expanded in a around inf

                                          \[\leadsto x + \color{blue}{a} \cdot b \]
                                        3. Step-by-step derivation
                                          1. Applied rewrites47.3%

                                            \[\leadsto x + \color{blue}{a} \cdot b \]
                                          2. Step-by-step derivation
                                            1. lift-+.f64N/A

                                              \[\leadsto \color{blue}{x + a \cdot b} \]
                                            2. +-commutativeN/A

                                              \[\leadsto \color{blue}{a \cdot b + x} \]
                                            3. lift-*.f64N/A

                                              \[\leadsto \color{blue}{a \cdot b} + x \]
                                            4. lower-fma.f6447.3

                                              \[\leadsto \color{blue}{\mathsf{fma}\left(a, b, x\right)} \]
                                          3. Applied rewrites47.3%

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

                                          if -2.0000000000000001e-4 < (+.f64 x y) < -1.00000000000000003e-53

                                          1. Initial program 99.8%

                                            \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
                                          2. Taylor expanded in b around inf

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

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

                                              \[\leadsto \left(a - \frac{1}{2}\right) \cdot b \]
                                            3. lift-*.f6450.3

                                              \[\leadsto \left(a - 0.5\right) \cdot \color{blue}{b} \]
                                          4. Applied rewrites50.3%

                                            \[\leadsto \color{blue}{\left(a - 0.5\right) \cdot b} \]
                                          5. Taylor expanded in a around 0

                                            \[\leadsto \frac{-1}{2} \cdot b \]
                                          6. Step-by-step derivation
                                            1. Applied rewrites19.1%

                                              \[\leadsto -0.5 \cdot b \]

                                            if -1.00000000000000003e-53 < (+.f64 x y)

                                            1. Initial program 99.8%

                                              \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
                                            2. Taylor expanded in x around inf

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

                                                \[\leadsto \color{blue}{x} + \left(a - 0.5\right) \cdot b \]
                                              2. Taylor expanded in a around inf

                                                \[\leadsto x + \color{blue}{a} \cdot b \]
                                              3. Step-by-step derivation
                                                1. Applied rewrites45.6%

                                                  \[\leadsto x + \color{blue}{a} \cdot b \]
                                                2. Taylor expanded in y around inf

                                                  \[\leadsto \color{blue}{y} + a \cdot b \]
                                                3. Step-by-step derivation
                                                  1. Applied rewrites44.9%

                                                    \[\leadsto \color{blue}{y} + a \cdot b \]
                                                  2. Step-by-step derivation
                                                    1. lift-+.f64N/A

                                                      \[\leadsto \color{blue}{y + a \cdot b} \]
                                                    2. +-commutativeN/A

                                                      \[\leadsto \color{blue}{a \cdot b + y} \]
                                                    3. lift-*.f64N/A

                                                      \[\leadsto \color{blue}{a \cdot b} + y \]
                                                    4. lower-fma.f6444.9

                                                      \[\leadsto \color{blue}{\mathsf{fma}\left(a, b, y\right)} \]
                                                  3. Applied rewrites44.9%

                                                    \[\leadsto \color{blue}{\mathsf{fma}\left(a, b, y\right)} \]
                                                4. Recombined 3 regimes into one program.
                                                5. Add Preprocessing

                                                Alternative 11: 50.1% accurate, 0.6× speedup?

                                                \[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(a - 0.5\right) \cdot b\\ \mathbf{if}\;t\_1 \leq -2 \cdot 10^{+286}:\\ \;\;\;\;b \cdot a\\ \mathbf{elif}\;t\_1 \leq -1 \cdot 10^{+213}:\\ \;\;\;\;-0.5 \cdot b\\ \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+130}:\\ \;\;\;\;y + x\\ \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+272}:\\ \;\;\;\;-0.5 \cdot b\\ \mathbf{else}:\\ \;\;\;\;b \cdot a\\ \end{array} \end{array} \]
                                                (FPCore (x y z t a b)
                                                 :precision binary64
                                                 (let* ((t_1 (* (- a 0.5) b)))
                                                   (if (<= t_1 -2e+286)
                                                     (* b a)
                                                     (if (<= t_1 -1e+213)
                                                       (* -0.5 b)
                                                       (if (<= t_1 2e+130) (+ y x) (if (<= t_1 2e+272) (* -0.5 b) (* b a)))))))
                                                double code(double x, double y, double z, double t, double a, double b) {
                                                	double t_1 = (a - 0.5) * b;
                                                	double tmp;
                                                	if (t_1 <= -2e+286) {
                                                		tmp = b * a;
                                                	} else if (t_1 <= -1e+213) {
                                                		tmp = -0.5 * b;
                                                	} else if (t_1 <= 2e+130) {
                                                		tmp = y + x;
                                                	} else if (t_1 <= 2e+272) {
                                                		tmp = -0.5 * b;
                                                	} else {
                                                		tmp = b * a;
                                                	}
                                                	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(x, y, z, t, a, b)
                                                use fmin_fmax_functions
                                                    real(8), intent (in) :: x
                                                    real(8), intent (in) :: y
                                                    real(8), intent (in) :: z
                                                    real(8), intent (in) :: t
                                                    real(8), intent (in) :: a
                                                    real(8), intent (in) :: b
                                                    real(8) :: t_1
                                                    real(8) :: tmp
                                                    t_1 = (a - 0.5d0) * b
                                                    if (t_1 <= (-2d+286)) then
                                                        tmp = b * a
                                                    else if (t_1 <= (-1d+213)) then
                                                        tmp = (-0.5d0) * b
                                                    else if (t_1 <= 2d+130) then
                                                        tmp = y + x
                                                    else if (t_1 <= 2d+272) then
                                                        tmp = (-0.5d0) * b
                                                    else
                                                        tmp = b * a
                                                    end if
                                                    code = tmp
                                                end function
                                                
                                                public static double code(double x, double y, double z, double t, double a, double b) {
                                                	double t_1 = (a - 0.5) * b;
                                                	double tmp;
                                                	if (t_1 <= -2e+286) {
                                                		tmp = b * a;
                                                	} else if (t_1 <= -1e+213) {
                                                		tmp = -0.5 * b;
                                                	} else if (t_1 <= 2e+130) {
                                                		tmp = y + x;
                                                	} else if (t_1 <= 2e+272) {
                                                		tmp = -0.5 * b;
                                                	} else {
                                                		tmp = b * a;
                                                	}
                                                	return tmp;
                                                }
                                                
                                                def code(x, y, z, t, a, b):
                                                	t_1 = (a - 0.5) * b
                                                	tmp = 0
                                                	if t_1 <= -2e+286:
                                                		tmp = b * a
                                                	elif t_1 <= -1e+213:
                                                		tmp = -0.5 * b
                                                	elif t_1 <= 2e+130:
                                                		tmp = y + x
                                                	elif t_1 <= 2e+272:
                                                		tmp = -0.5 * b
                                                	else:
                                                		tmp = b * a
                                                	return tmp
                                                
                                                function code(x, y, z, t, a, b)
                                                	t_1 = Float64(Float64(a - 0.5) * b)
                                                	tmp = 0.0
                                                	if (t_1 <= -2e+286)
                                                		tmp = Float64(b * a);
                                                	elseif (t_1 <= -1e+213)
                                                		tmp = Float64(-0.5 * b);
                                                	elseif (t_1 <= 2e+130)
                                                		tmp = Float64(y + x);
                                                	elseif (t_1 <= 2e+272)
                                                		tmp = Float64(-0.5 * b);
                                                	else
                                                		tmp = Float64(b * a);
                                                	end
                                                	return tmp
                                                end
                                                
                                                function tmp_2 = code(x, y, z, t, a, b)
                                                	t_1 = (a - 0.5) * b;
                                                	tmp = 0.0;
                                                	if (t_1 <= -2e+286)
                                                		tmp = b * a;
                                                	elseif (t_1 <= -1e+213)
                                                		tmp = -0.5 * b;
                                                	elseif (t_1 <= 2e+130)
                                                		tmp = y + x;
                                                	elseif (t_1 <= 2e+272)
                                                		tmp = -0.5 * b;
                                                	else
                                                		tmp = b * a;
                                                	end
                                                	tmp_2 = tmp;
                                                end
                                                
                                                code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+286], N[(b * a), $MachinePrecision], If[LessEqual[t$95$1, -1e+213], N[(-0.5 * b), $MachinePrecision], If[LessEqual[t$95$1, 2e+130], N[(y + x), $MachinePrecision], If[LessEqual[t$95$1, 2e+272], N[(-0.5 * b), $MachinePrecision], N[(b * a), $MachinePrecision]]]]]]
                                                
                                                \begin{array}{l}
                                                
                                                \\
                                                \begin{array}{l}
                                                t_1 := \left(a - 0.5\right) \cdot b\\
                                                \mathbf{if}\;t\_1 \leq -2 \cdot 10^{+286}:\\
                                                \;\;\;\;b \cdot a\\
                                                
                                                \mathbf{elif}\;t\_1 \leq -1 \cdot 10^{+213}:\\
                                                \;\;\;\;-0.5 \cdot b\\
                                                
                                                \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+130}:\\
                                                \;\;\;\;y + x\\
                                                
                                                \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+272}:\\
                                                \;\;\;\;-0.5 \cdot b\\
                                                
                                                \mathbf{else}:\\
                                                \;\;\;\;b \cdot a\\
                                                
                                                
                                                \end{array}
                                                \end{array}
                                                
                                                Derivation
                                                1. Split input into 3 regimes
                                                2. if (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < -2.00000000000000007e286 or 2.0000000000000001e272 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b)

                                                  1. Initial program 99.8%

                                                    \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
                                                  2. Taylor expanded in a around inf

                                                    \[\leadsto \color{blue}{a \cdot b} \]
                                                  3. Step-by-step derivation
                                                    1. *-commutativeN/A

                                                      \[\leadsto b \cdot \color{blue}{a} \]
                                                    2. lower-*.f6483.4

                                                      \[\leadsto b \cdot \color{blue}{a} \]
                                                  4. Applied rewrites83.4%

                                                    \[\leadsto \color{blue}{b \cdot a} \]

                                                  if -2.00000000000000007e286 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < -9.99999999999999984e212 or 2.0000000000000001e130 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < 2.0000000000000001e272

                                                  1. Initial program 99.9%

                                                    \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
                                                  2. Taylor expanded in b around inf

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

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

                                                      \[\leadsto \left(a - \frac{1}{2}\right) \cdot b \]
                                                    3. lift-*.f6463.3

                                                      \[\leadsto \left(a - 0.5\right) \cdot \color{blue}{b} \]
                                                  4. Applied rewrites63.3%

                                                    \[\leadsto \color{blue}{\left(a - 0.5\right) \cdot b} \]
                                                  5. Taylor expanded in a around 0

                                                    \[\leadsto \frac{-1}{2} \cdot b \]
                                                  6. Step-by-step derivation
                                                    1. Applied rewrites32.2%

                                                      \[\leadsto -0.5 \cdot b \]

                                                    if -9.99999999999999984e212 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < 2.0000000000000001e130

                                                    1. Initial program 99.8%

                                                      \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
                                                    2. Taylor expanded in z around 0

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

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

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

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

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

                                                        \[\leadsto \mathsf{fma}\left(a - \frac{1}{2}, b, y\right) + x \]
                                                      6. lift--.f6471.1

                                                        \[\leadsto \mathsf{fma}\left(a - 0.5, b, y\right) + x \]
                                                    4. Applied rewrites71.1%

                                                      \[\leadsto \color{blue}{\mathsf{fma}\left(a - 0.5, b, y\right) + x} \]
                                                    5. Taylor expanded in y around inf

                                                      \[\leadsto y + x \]
                                                    6. Step-by-step derivation
                                                      1. Applied rewrites57.9%

                                                        \[\leadsto y + x \]
                                                    7. Recombined 3 regimes into one program.
                                                    8. Add Preprocessing

                                                    Alternative 12: 45.9% accurate, 0.8× speedup?

                                                    \[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(a - 0.5\right) \cdot b\\ \mathbf{if}\;t\_1 \leq -5 \cdot 10^{+130}:\\ \;\;\;\;\mathsf{fma}\left(a, b, x\right)\\ \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+130}:\\ \;\;\;\;y + x\\ \mathbf{elif}\;t\_1 \leq 10^{+239}:\\ \;\;\;\;-0.5 \cdot b\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(a, b, x\right)\\ \end{array} \end{array} \]
                                                    (FPCore (x y z t a b)
                                                     :precision binary64
                                                     (let* ((t_1 (* (- a 0.5) b)))
                                                       (if (<= t_1 -5e+130)
                                                         (fma a b x)
                                                         (if (<= t_1 2e+130)
                                                           (+ y x)
                                                           (if (<= t_1 1e+239) (* -0.5 b) (fma a b x))))))
                                                    double code(double x, double y, double z, double t, double a, double b) {
                                                    	double t_1 = (a - 0.5) * b;
                                                    	double tmp;
                                                    	if (t_1 <= -5e+130) {
                                                    		tmp = fma(a, b, x);
                                                    	} else if (t_1 <= 2e+130) {
                                                    		tmp = y + x;
                                                    	} else if (t_1 <= 1e+239) {
                                                    		tmp = -0.5 * b;
                                                    	} else {
                                                    		tmp = fma(a, b, x);
                                                    	}
                                                    	return tmp;
                                                    }
                                                    
                                                    function code(x, y, z, t, a, b)
                                                    	t_1 = Float64(Float64(a - 0.5) * b)
                                                    	tmp = 0.0
                                                    	if (t_1 <= -5e+130)
                                                    		tmp = fma(a, b, x);
                                                    	elseif (t_1 <= 2e+130)
                                                    		tmp = Float64(y + x);
                                                    	elseif (t_1 <= 1e+239)
                                                    		tmp = Float64(-0.5 * b);
                                                    	else
                                                    		tmp = fma(a, b, x);
                                                    	end
                                                    	return tmp
                                                    end
                                                    
                                                    code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+130], N[(a * b + x), $MachinePrecision], If[LessEqual[t$95$1, 2e+130], N[(y + x), $MachinePrecision], If[LessEqual[t$95$1, 1e+239], N[(-0.5 * b), $MachinePrecision], N[(a * b + x), $MachinePrecision]]]]]
                                                    
                                                    \begin{array}{l}
                                                    
                                                    \\
                                                    \begin{array}{l}
                                                    t_1 := \left(a - 0.5\right) \cdot b\\
                                                    \mathbf{if}\;t\_1 \leq -5 \cdot 10^{+130}:\\
                                                    \;\;\;\;\mathsf{fma}\left(a, b, x\right)\\
                                                    
                                                    \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+130}:\\
                                                    \;\;\;\;y + x\\
                                                    
                                                    \mathbf{elif}\;t\_1 \leq 10^{+239}:\\
                                                    \;\;\;\;-0.5 \cdot b\\
                                                    
                                                    \mathbf{else}:\\
                                                    \;\;\;\;\mathsf{fma}\left(a, b, x\right)\\
                                                    
                                                    
                                                    \end{array}
                                                    \end{array}
                                                    
                                                    Derivation
                                                    1. Split input into 3 regimes
                                                    2. if (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < -4.9999999999999996e130 or 9.99999999999999991e238 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b)

                                                      1. Initial program 99.9%

                                                        \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
                                                      2. Taylor expanded in x around inf

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

                                                          \[\leadsto \color{blue}{x} + \left(a - 0.5\right) \cdot b \]
                                                        2. Taylor expanded in a around inf

                                                          \[\leadsto x + \color{blue}{a} \cdot b \]
                                                        3. Step-by-step derivation
                                                          1. Applied rewrites65.4%

                                                            \[\leadsto x + \color{blue}{a} \cdot b \]
                                                          2. Step-by-step derivation
                                                            1. lift-+.f64N/A

                                                              \[\leadsto \color{blue}{x + a \cdot b} \]
                                                            2. +-commutativeN/A

                                                              \[\leadsto \color{blue}{a \cdot b + x} \]
                                                            3. lift-*.f64N/A

                                                              \[\leadsto \color{blue}{a \cdot b} + x \]
                                                            4. lower-fma.f6465.4

                                                              \[\leadsto \color{blue}{\mathsf{fma}\left(a, b, x\right)} \]
                                                          3. Applied rewrites65.4%

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

                                                          if -4.9999999999999996e130 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < 2.0000000000000001e130

                                                          1. Initial program 99.8%

                                                            \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
                                                          2. Taylor expanded in z around 0

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

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

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

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

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

                                                              \[\leadsto \mathsf{fma}\left(a - \frac{1}{2}, b, y\right) + x \]
                                                            6. lift--.f6469.9

                                                              \[\leadsto \mathsf{fma}\left(a - 0.5, b, y\right) + x \]
                                                          4. Applied rewrites69.9%

                                                            \[\leadsto \color{blue}{\mathsf{fma}\left(a - 0.5, b, y\right) + x} \]
                                                          5. Taylor expanded in y around inf

                                                            \[\leadsto y + x \]
                                                          6. Step-by-step derivation
                                                            1. Applied rewrites60.3%

                                                              \[\leadsto y + x \]

                                                            if 2.0000000000000001e130 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < 9.99999999999999991e238

                                                            1. Initial program 99.9%

                                                              \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
                                                            2. Taylor expanded in b around inf

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

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

                                                                \[\leadsto \left(a - \frac{1}{2}\right) \cdot b \]
                                                              3. lift-*.f6453.9

                                                                \[\leadsto \left(a - 0.5\right) \cdot \color{blue}{b} \]
                                                            4. Applied rewrites53.9%

                                                              \[\leadsto \color{blue}{\left(a - 0.5\right) \cdot b} \]
                                                            5. Taylor expanded in a around 0

                                                              \[\leadsto \frac{-1}{2} \cdot b \]
                                                            6. Step-by-step derivation
                                                              1. Applied rewrites27.3%

                                                                \[\leadsto -0.5 \cdot b \]
                                                            7. Recombined 3 regimes into one program.
                                                            8. Add Preprocessing

                                                            Alternative 13: 44.8% accurate, 1.1× speedup?

                                                            \[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(a - 0.5\right) \cdot b\\ \mathbf{if}\;t\_1 \leq -1 \cdot 10^{+213}:\\ \;\;\;\;b \cdot a\\ \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+246}:\\ \;\;\;\;y + x\\ \mathbf{else}:\\ \;\;\;\;b \cdot a\\ \end{array} \end{array} \]
                                                            (FPCore (x y z t a b)
                                                             :precision binary64
                                                             (let* ((t_1 (* (- a 0.5) b)))
                                                               (if (<= t_1 -1e+213) (* b a) (if (<= t_1 2e+246) (+ y x) (* b a)))))
                                                            double code(double x, double y, double z, double t, double a, double b) {
                                                            	double t_1 = (a - 0.5) * b;
                                                            	double tmp;
                                                            	if (t_1 <= -1e+213) {
                                                            		tmp = b * a;
                                                            	} else if (t_1 <= 2e+246) {
                                                            		tmp = y + x;
                                                            	} else {
                                                            		tmp = b * a;
                                                            	}
                                                            	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(x, y, z, t, a, b)
                                                            use fmin_fmax_functions
                                                                real(8), intent (in) :: x
                                                                real(8), intent (in) :: y
                                                                real(8), intent (in) :: z
                                                                real(8), intent (in) :: t
                                                                real(8), intent (in) :: a
                                                                real(8), intent (in) :: b
                                                                real(8) :: t_1
                                                                real(8) :: tmp
                                                                t_1 = (a - 0.5d0) * b
                                                                if (t_1 <= (-1d+213)) then
                                                                    tmp = b * a
                                                                else if (t_1 <= 2d+246) then
                                                                    tmp = y + x
                                                                else
                                                                    tmp = b * a
                                                                end if
                                                                code = tmp
                                                            end function
                                                            
                                                            public static double code(double x, double y, double z, double t, double a, double b) {
                                                            	double t_1 = (a - 0.5) * b;
                                                            	double tmp;
                                                            	if (t_1 <= -1e+213) {
                                                            		tmp = b * a;
                                                            	} else if (t_1 <= 2e+246) {
                                                            		tmp = y + x;
                                                            	} else {
                                                            		tmp = b * a;
                                                            	}
                                                            	return tmp;
                                                            }
                                                            
                                                            def code(x, y, z, t, a, b):
                                                            	t_1 = (a - 0.5) * b
                                                            	tmp = 0
                                                            	if t_1 <= -1e+213:
                                                            		tmp = b * a
                                                            	elif t_1 <= 2e+246:
                                                            		tmp = y + x
                                                            	else:
                                                            		tmp = b * a
                                                            	return tmp
                                                            
                                                            function code(x, y, z, t, a, b)
                                                            	t_1 = Float64(Float64(a - 0.5) * b)
                                                            	tmp = 0.0
                                                            	if (t_1 <= -1e+213)
                                                            		tmp = Float64(b * a);
                                                            	elseif (t_1 <= 2e+246)
                                                            		tmp = Float64(y + x);
                                                            	else
                                                            		tmp = Float64(b * a);
                                                            	end
                                                            	return tmp
                                                            end
                                                            
                                                            function tmp_2 = code(x, y, z, t, a, b)
                                                            	t_1 = (a - 0.5) * b;
                                                            	tmp = 0.0;
                                                            	if (t_1 <= -1e+213)
                                                            		tmp = b * a;
                                                            	elseif (t_1 <= 2e+246)
                                                            		tmp = y + x;
                                                            	else
                                                            		tmp = b * a;
                                                            	end
                                                            	tmp_2 = tmp;
                                                            end
                                                            
                                                            code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+213], N[(b * a), $MachinePrecision], If[LessEqual[t$95$1, 2e+246], N[(y + x), $MachinePrecision], N[(b * a), $MachinePrecision]]]]
                                                            
                                                            \begin{array}{l}
                                                            
                                                            \\
                                                            \begin{array}{l}
                                                            t_1 := \left(a - 0.5\right) \cdot b\\
                                                            \mathbf{if}\;t\_1 \leq -1 \cdot 10^{+213}:\\
                                                            \;\;\;\;b \cdot a\\
                                                            
                                                            \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+246}:\\
                                                            \;\;\;\;y + x\\
                                                            
                                                            \mathbf{else}:\\
                                                            \;\;\;\;b \cdot a\\
                                                            
                                                            
                                                            \end{array}
                                                            \end{array}
                                                            
                                                            Derivation
                                                            1. Split input into 2 regimes
                                                            2. if (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < -9.99999999999999984e212 or 2.00000000000000014e246 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b)

                                                              1. Initial program 99.9%

                                                                \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
                                                              2. Taylor expanded in a around inf

                                                                \[\leadsto \color{blue}{a \cdot b} \]
                                                              3. Step-by-step derivation
                                                                1. *-commutativeN/A

                                                                  \[\leadsto b \cdot \color{blue}{a} \]
                                                                2. lower-*.f6468.7

                                                                  \[\leadsto b \cdot \color{blue}{a} \]
                                                              4. Applied rewrites68.7%

                                                                \[\leadsto \color{blue}{b \cdot a} \]

                                                              if -9.99999999999999984e212 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < 2.00000000000000014e246

                                                              1. Initial program 99.8%

                                                                \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
                                                              2. Taylor expanded in z around 0

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

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

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

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

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

                                                                  \[\leadsto \mathsf{fma}\left(a - \frac{1}{2}, b, y\right) + x \]
                                                                6. lift--.f6472.8

                                                                  \[\leadsto \mathsf{fma}\left(a - 0.5, b, y\right) + x \]
                                                              4. Applied rewrites72.8%

                                                                \[\leadsto \color{blue}{\mathsf{fma}\left(a - 0.5, b, y\right) + x} \]
                                                              5. Taylor expanded in y around inf

                                                                \[\leadsto y + x \]
                                                              6. Step-by-step derivation
                                                                1. Applied rewrites54.3%

                                                                  \[\leadsto y + x \]
                                                              7. Recombined 2 regimes into one program.
                                                              8. Add Preprocessing

                                                              Alternative 14: 42.7% accurate, 7.0× speedup?

                                                              \[\begin{array}{l} \\ y + x \end{array} \]
                                                              (FPCore (x y z t a b) :precision binary64 (+ y x))
                                                              double code(double x, double y, double z, double t, double a, double b) {
                                                              	return y + x;
                                                              }
                                                              
                                                              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(x, y, z, t, a, b)
                                                              use fmin_fmax_functions
                                                                  real(8), intent (in) :: x
                                                                  real(8), intent (in) :: y
                                                                  real(8), intent (in) :: z
                                                                  real(8), intent (in) :: t
                                                                  real(8), intent (in) :: a
                                                                  real(8), intent (in) :: b
                                                                  code = y + x
                                                              end function
                                                              
                                                              public static double code(double x, double y, double z, double t, double a, double b) {
                                                              	return y + x;
                                                              }
                                                              
                                                              def code(x, y, z, t, a, b):
                                                              	return y + x
                                                              
                                                              function code(x, y, z, t, a, b)
                                                              	return Float64(y + x)
                                                              end
                                                              
                                                              function tmp = code(x, y, z, t, a, b)
                                                              	tmp = y + x;
                                                              end
                                                              
                                                              code[x_, y_, z_, t_, a_, b_] := N[(y + x), $MachinePrecision]
                                                              
                                                              \begin{array}{l}
                                                              
                                                              \\
                                                              y + x
                                                              \end{array}
                                                              
                                                              Derivation
                                                              1. Initial program 99.8%

                                                                \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
                                                              2. Taylor expanded in z around 0

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

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

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

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

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

                                                                  \[\leadsto \mathsf{fma}\left(a - \frac{1}{2}, b, y\right) + x \]
                                                                6. lift--.f6478.8

                                                                  \[\leadsto \mathsf{fma}\left(a - 0.5, b, y\right) + x \]
                                                              4. Applied rewrites78.8%

                                                                \[\leadsto \color{blue}{\mathsf{fma}\left(a - 0.5, b, y\right) + x} \]
                                                              5. Taylor expanded in y around inf

                                                                \[\leadsto y + x \]
                                                              6. Step-by-step derivation
                                                                1. Applied rewrites42.7%

                                                                  \[\leadsto y + x \]
                                                                2. Add Preprocessing

                                                                Alternative 15: 22.2% accurate, 0.9× speedup?

                                                                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \leq -1 \cdot 10^{-45}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \end{array} \]
                                                                (FPCore (x y z t a b)
                                                                 :precision binary64
                                                                 (if (<= (+ (- (+ (+ x y) z) (* z (log t))) (* (- a 0.5) b)) -1e-45) x y))
                                                                double code(double x, double y, double z, double t, double a, double b) {
                                                                	double tmp;
                                                                	if (((((x + y) + z) - (z * log(t))) + ((a - 0.5) * b)) <= -1e-45) {
                                                                		tmp = x;
                                                                	} else {
                                                                		tmp = y;
                                                                	}
                                                                	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(x, y, z, t, a, b)
                                                                use fmin_fmax_functions
                                                                    real(8), intent (in) :: x
                                                                    real(8), intent (in) :: y
                                                                    real(8), intent (in) :: z
                                                                    real(8), intent (in) :: t
                                                                    real(8), intent (in) :: a
                                                                    real(8), intent (in) :: b
                                                                    real(8) :: tmp
                                                                    if (((((x + y) + z) - (z * log(t))) + ((a - 0.5d0) * b)) <= (-1d-45)) then
                                                                        tmp = x
                                                                    else
                                                                        tmp = y
                                                                    end if
                                                                    code = tmp
                                                                end function
                                                                
                                                                public static double code(double x, double y, double z, double t, double a, double b) {
                                                                	double tmp;
                                                                	if (((((x + y) + z) - (z * Math.log(t))) + ((a - 0.5) * b)) <= -1e-45) {
                                                                		tmp = x;
                                                                	} else {
                                                                		tmp = y;
                                                                	}
                                                                	return tmp;
                                                                }
                                                                
                                                                def code(x, y, z, t, a, b):
                                                                	tmp = 0
                                                                	if ((((x + y) + z) - (z * math.log(t))) + ((a - 0.5) * b)) <= -1e-45:
                                                                		tmp = x
                                                                	else:
                                                                		tmp = y
                                                                	return tmp
                                                                
                                                                function code(x, y, z, t, a, b)
                                                                	tmp = 0.0
                                                                	if (Float64(Float64(Float64(Float64(x + y) + z) - Float64(z * log(t))) + Float64(Float64(a - 0.5) * b)) <= -1e-45)
                                                                		tmp = x;
                                                                	else
                                                                		tmp = y;
                                                                	end
                                                                	return tmp
                                                                end
                                                                
                                                                function tmp_2 = code(x, y, z, t, a, b)
                                                                	tmp = 0.0;
                                                                	if (((((x + y) + z) - (z * log(t))) + ((a - 0.5) * b)) <= -1e-45)
                                                                		tmp = x;
                                                                	else
                                                                		tmp = y;
                                                                	end
                                                                	tmp_2 = tmp;
                                                                end
                                                                
                                                                code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(N[(N[(N[(x + y), $MachinePrecision] + z), $MachinePrecision] - N[(z * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], -1e-45], x, y]
                                                                
                                                                \begin{array}{l}
                                                                
                                                                \\
                                                                \begin{array}{l}
                                                                \mathbf{if}\;\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \leq -1 \cdot 10^{-45}:\\
                                                                \;\;\;\;x\\
                                                                
                                                                \mathbf{else}:\\
                                                                \;\;\;\;y\\
                                                                
                                                                
                                                                \end{array}
                                                                \end{array}
                                                                
                                                                Derivation
                                                                1. Split input into 2 regimes
                                                                2. if (+.f64 (-.f64 (+.f64 (+.f64 x y) z) (*.f64 z (log.f64 t))) (*.f64 (-.f64 a #s(literal 1/2 binary64)) b)) < -9.99999999999999984e-46

                                                                  1. Initial program 99.9%

                                                                    \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
                                                                  2. Taylor expanded in x around inf

                                                                    \[\leadsto \color{blue}{x} \]
                                                                  3. Step-by-step derivation
                                                                    1. Applied rewrites22.0%

                                                                      \[\leadsto \color{blue}{x} \]

                                                                    if -9.99999999999999984e-46 < (+.f64 (-.f64 (+.f64 (+.f64 x y) z) (*.f64 z (log.f64 t))) (*.f64 (-.f64 a #s(literal 1/2 binary64)) b))

                                                                    1. Initial program 99.8%

                                                                      \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
                                                                    2. Taylor expanded in y around inf

                                                                      \[\leadsto \color{blue}{y} \]
                                                                    3. Step-by-step derivation
                                                                      1. Applied rewrites21.7%

                                                                        \[\leadsto \color{blue}{y} \]
                                                                    4. Recombined 2 regimes into one program.
                                                                    5. Add Preprocessing

                                                                    Alternative 16: 21.8% accurate, 26.1× speedup?

                                                                    \[\begin{array}{l} \\ x \end{array} \]
                                                                    (FPCore (x y z t a b) :precision binary64 x)
                                                                    double code(double x, double y, double z, double t, double a, double b) {
                                                                    	return x;
                                                                    }
                                                                    
                                                                    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(x, y, z, t, a, b)
                                                                    use fmin_fmax_functions
                                                                        real(8), intent (in) :: x
                                                                        real(8), intent (in) :: y
                                                                        real(8), intent (in) :: z
                                                                        real(8), intent (in) :: t
                                                                        real(8), intent (in) :: a
                                                                        real(8), intent (in) :: b
                                                                        code = x
                                                                    end function
                                                                    
                                                                    public static double code(double x, double y, double z, double t, double a, double b) {
                                                                    	return x;
                                                                    }
                                                                    
                                                                    def code(x, y, z, t, a, b):
                                                                    	return x
                                                                    
                                                                    function code(x, y, z, t, a, b)
                                                                    	return x
                                                                    end
                                                                    
                                                                    function tmp = code(x, y, z, t, a, b)
                                                                    	tmp = x;
                                                                    end
                                                                    
                                                                    code[x_, y_, z_, t_, a_, b_] := x
                                                                    
                                                                    \begin{array}{l}
                                                                    
                                                                    \\
                                                                    x
                                                                    \end{array}
                                                                    
                                                                    Derivation
                                                                    1. Initial program 99.8%

                                                                      \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
                                                                    2. Taylor expanded in x around inf

                                                                      \[\leadsto \color{blue}{x} \]
                                                                    3. Step-by-step derivation
                                                                      1. Applied rewrites22.2%

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

                                                                      Reproduce

                                                                      ?
                                                                      herbie shell --seed 2025114 
                                                                      (FPCore (x y z t a b)
                                                                        :name "Numeric.SpecFunctions:logBeta from math-functions-0.1.5.2, A"
                                                                        :precision binary64
                                                                        (+ (- (+ (+ x y) z) (* z (log t))) (* (- a 0.5) b)))