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

Percentage Accurate: 99.8% → 99.9%
Time: 11.1s
Alternatives: 15
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 15 alternatives:

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

Initial Program: 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.9% accurate, 1.0× speedup?

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

\\
\mathsf{fma}\left(\left(-\log t\right) + 1, z, \mathsf{fma}\left(a - 0.5, b, x + y\right)\right)
\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. Applied rewrites99.9%

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

Alternative 2: 99.8% accurate, 1.0× speedup?

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

\\
\mathsf{fma}\left(a - 0.5, b, z\right) - \left(\left(z \cdot \log t - x\right) - y\right)
\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. Applied rewrites99.8%

    \[\leadsto \color{blue}{\mathsf{fma}\left(a - 0.5, b, z\right) - \left(\left(z \cdot \log t - x\right) - y\right)} \]
  3. Add Preprocessing

Alternative 3: 92.3% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -2 \cdot 10^{-143}:\\
\;\;\;\;\mathsf{fma}\left(1 - \log t, z, \mathsf{fma}\left(a - 0.5, b, x\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\left(\left(y + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 x y) < -1.9999999999999999e-143

    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. Applied rewrites99.9%

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

      \[\leadsto \color{blue}{x + \left(b \cdot \left(a - \frac{1}{2}\right) + z \cdot \left(1 - \log t\right)\right)} \]
    4. Applied rewrites78.4%

      \[\leadsto \color{blue}{x + \mathsf{fma}\left(b, a - 0.5, z \cdot \left(1 - \log t\right)\right)} \]
    5. Applied rewrites78.4%

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

    if -1.9999999999999999e-143 < (+.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 0

      \[\leadsto \left(\left(\color{blue}{y} + z\right) - z \cdot \log t\right) + \left(a - \frac{1}{2}\right) \cdot b \]
    3. Applied rewrites79.3%

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

Alternative 4: 92.3% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(a - 0.5\right) \cdot b\\ t_2 := \left(\left(x + z\right) - z \cdot \log t\right) + t\_1\\ \mathbf{if}\;t\_1 \leq -5 \cdot 10^{+180}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+75}:\\ \;\;\;\;\mathsf{fma}\left(\left(-\log t\right) + 1, z, \mathsf{fma}\left(-0.5, b, x + y\right)\right)\\ \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 (+ (- (+ x z) (* z (log t))) t_1)))
   (if (<= t_1 -5e+180)
     t_2
     (if (<= t_1 5e+75)
       (fma (+ (- (log t)) 1.0) z (fma -0.5 b (+ x y)))
       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 = ((x + z) - (z * log(t))) + t_1;
	double tmp;
	if (t_1 <= -5e+180) {
		tmp = t_2;
	} else if (t_1 <= 5e+75) {
		tmp = fma((-log(t) + 1.0), z, fma(-0.5, b, (x + y)));
	} 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(Float64(Float64(x + z) - Float64(z * log(t))) + t_1)
	tmp = 0.0
	if (t_1 <= -5e+180)
		tmp = t_2;
	elseif (t_1 <= 5e+75)
		tmp = fma(Float64(Float64(-log(t)) + 1.0), z, fma(-0.5, b, Float64(x + y)));
	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[(x + z), $MachinePrecision] - N[(z * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+180], t$95$2, If[LessEqual[t$95$1, 5e+75], N[(N[((-N[Log[t], $MachinePrecision]) + 1.0), $MachinePrecision] * z + N[(-0.5 * b + N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left(a - 0.5\right) \cdot b\\
t_2 := \left(\left(x + z\right) - z \cdot \log t\right) + t\_1\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+180}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+75}:\\
\;\;\;\;\mathsf{fma}\left(\left(-\log t\right) + 1, z, \mathsf{fma}\left(-0.5, b, x + y\right)\right)\\

\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) < -4.9999999999999996e180 or 5.0000000000000002e75 < (*.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 0

      \[\leadsto \left(\color{blue}{\left(x + z\right)} - z \cdot \log t\right) + \left(a - \frac{1}{2}\right) \cdot b \]
    3. Applied rewrites78.4%

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

    if -4.9999999999999996e180 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < 5.0000000000000002e75

    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. Applied rewrites99.9%

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

      \[\leadsto \mathsf{fma}\left(\left(-\log t\right) + 1, z, \mathsf{fma}\left(\color{blue}{\frac{-1}{2}}, b, x + y\right)\right) \]
    4. Applied rewrites75.5%

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

Alternative 5: 91.5% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(a - 0.5\right) \cdot b\\ t_2 := \mathsf{fma}\left(1 - \log t, z, \mathsf{fma}\left(a - 0.5, b, x\right)\right)\\ \mathbf{if}\;t\_1 \leq -5 \cdot 10^{+180}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+75}:\\ \;\;\;\;\mathsf{fma}\left(\left(-\log t\right) + 1, z, \mathsf{fma}\left(-0.5, b, x + y\right)\right)\\ \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 (- 1.0 (log t)) z (fma (- a 0.5) b x))))
   (if (<= t_1 -5e+180)
     t_2
     (if (<= t_1 5e+75)
       (fma (+ (- (log t)) 1.0) z (fma -0.5 b (+ x y)))
       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((1.0 - log(t)), z, fma((a - 0.5), b, x));
	double tmp;
	if (t_1 <= -5e+180) {
		tmp = t_2;
	} else if (t_1 <= 5e+75) {
		tmp = fma((-log(t) + 1.0), z, fma(-0.5, b, (x + y)));
	} else {
		tmp = t_2;
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	t_1 = Float64(Float64(a - 0.5) * b)
	t_2 = fma(Float64(1.0 - log(t)), z, fma(Float64(a - 0.5), b, x))
	tmp = 0.0
	if (t_1 <= -5e+180)
		tmp = t_2;
	elseif (t_1 <= 5e+75)
		tmp = fma(Float64(Float64(-log(t)) + 1.0), z, fma(-0.5, b, Float64(x + y)));
	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[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision] * z + N[(N[(a - 0.5), $MachinePrecision] * b + x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+180], t$95$2, If[LessEqual[t$95$1, 5e+75], N[(N[((-N[Log[t], $MachinePrecision]) + 1.0), $MachinePrecision] * z + N[(-0.5 * b + N[(x + y), $MachinePrecision]), $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(1 - \log t, z, \mathsf{fma}\left(a - 0.5, b, x\right)\right)\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+180}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+75}:\\
\;\;\;\;\mathsf{fma}\left(\left(-\log t\right) + 1, z, \mathsf{fma}\left(-0.5, b, x + y\right)\right)\\

\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) < -4.9999999999999996e180 or 5.0000000000000002e75 < (*.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. Applied rewrites99.9%

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

      \[\leadsto \color{blue}{x + \left(b \cdot \left(a - \frac{1}{2}\right) + z \cdot \left(1 - \log t\right)\right)} \]
    4. Applied rewrites78.4%

      \[\leadsto \color{blue}{x + \mathsf{fma}\left(b, a - 0.5, z \cdot \left(1 - \log t\right)\right)} \]
    5. Applied rewrites78.4%

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

    if -4.9999999999999996e180 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < 5.0000000000000002e75

    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. Applied rewrites99.9%

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

      \[\leadsto \mathsf{fma}\left(\left(-\log t\right) + 1, z, \mathsf{fma}\left(\color{blue}{\frac{-1}{2}}, b, x + y\right)\right) \]
    4. Applied rewrites75.5%

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

Alternative 6: 88.8% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \mathsf{fma}\left(1 - \log t, z, \mathsf{fma}\left(a - 0.5, b, x\right)\right)\\ \mathbf{if}\;z \leq -1.05 \cdot 10^{+135}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 1.12 \cdot 10^{+47}:\\ \;\;\;\;x + \left(y + b \cdot \left(a - 0.5\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (fma (- 1.0 (log t)) z (fma (- a 0.5) b x))))
   (if (<= z -1.05e+135)
     t_1
     (if (<= z 1.12e+47) (+ x (+ y (* b (- a 0.5)))) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = fma((1.0 - log(t)), z, fma((a - 0.5), b, x));
	double tmp;
	if (z <= -1.05e+135) {
		tmp = t_1;
	} else if (z <= 1.12e+47) {
		tmp = x + (y + (b * (a - 0.5)));
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	t_1 = fma(Float64(1.0 - log(t)), z, fma(Float64(a - 0.5), b, x))
	tmp = 0.0
	if (z <= -1.05e+135)
		tmp = t_1;
	elseif (z <= 1.12e+47)
		tmp = Float64(x + Float64(y + Float64(b * Float64(a - 0.5))));
	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 + N[(N[(a - 0.5), $MachinePrecision] * b + x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.05e+135], t$95$1, If[LessEqual[z, 1.12e+47], N[(x + N[(y + N[(b * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq 1.12 \cdot 10^{+47}:\\
\;\;\;\;x + \left(y + b \cdot \left(a - 0.5\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.05000000000000005e135 or 1.12000000000000007e47 < z

    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. Applied rewrites99.9%

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

      \[\leadsto \color{blue}{x + \left(b \cdot \left(a - \frac{1}{2}\right) + z \cdot \left(1 - \log t\right)\right)} \]
    4. Applied rewrites78.4%

      \[\leadsto \color{blue}{x + \mathsf{fma}\left(b, a - 0.5, z \cdot \left(1 - \log t\right)\right)} \]
    5. Applied rewrites78.4%

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

    if -1.05000000000000005e135 < z < 1.12000000000000007e47

    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. Applied rewrites78.7%

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

Alternative 7: 85.6% accurate, 0.9× speedup?

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

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

\mathbf{elif}\;z \leq 1.45 \cdot 10^{+142}:\\
\;\;\;\;x + \left(y + b \cdot \left(a - 0.5\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.35000000000000008e144 or 1.45000000000000007e142 < z

    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. Applied rewrites99.9%

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

      \[\leadsto \color{blue}{x + \left(b \cdot \left(a - \frac{1}{2}\right) + z \cdot \left(1 - \log t\right)\right)} \]
    4. Applied rewrites78.4%

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

      \[\leadsto b \cdot \left(a - \frac{1}{2}\right) + \color{blue}{z \cdot \left(1 - \log t\right)} \]
    6. Applied rewrites58.4%

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

    if -1.35000000000000008e144 < z < 1.45000000000000007e142

    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. Applied rewrites78.7%

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

Alternative 8: 84.5% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x + z \cdot \left(1 - \log t\right)\\ \mathbf{if}\;z \leq -6.5 \cdot 10^{+184}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 2.6 \cdot 10^{+218}:\\ \;\;\;\;x + \left(y + b \cdot \left(a - 0.5\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (+ x (* z (- 1.0 (log t))))))
   (if (<= z -6.5e+184)
     t_1
     (if (<= z 2.6e+218) (+ x (+ y (* b (- a 0.5)))) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = x + (z * (1.0 - log(t)));
	double tmp;
	if (z <= -6.5e+184) {
		tmp = t_1;
	} else if (z <= 2.6e+218) {
		tmp = x + (y + (b * (a - 0.5)));
	} else {
		tmp = t_1;
	}
	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 = x + (z * (1.0d0 - log(t)))
    if (z <= (-6.5d+184)) then
        tmp = t_1
    else if (z <= 2.6d+218) then
        tmp = x + (y + (b * (a - 0.5d0)))
    else
        tmp = t_1
    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 = x + (z * (1.0 - Math.log(t)));
	double tmp;
	if (z <= -6.5e+184) {
		tmp = t_1;
	} else if (z <= 2.6e+218) {
		tmp = x + (y + (b * (a - 0.5)));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	t_1 = x + (z * (1.0 - math.log(t)))
	tmp = 0
	if z <= -6.5e+184:
		tmp = t_1
	elif z <= 2.6e+218:
		tmp = x + (y + (b * (a - 0.5)))
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a, b)
	t_1 = Float64(x + Float64(z * Float64(1.0 - log(t))))
	tmp = 0.0
	if (z <= -6.5e+184)
		tmp = t_1;
	elseif (z <= 2.6e+218)
		tmp = Float64(x + Float64(y + Float64(b * Float64(a - 0.5))));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = x + (z * (1.0 - log(t)));
	tmp = 0.0;
	if (z <= -6.5e+184)
		tmp = t_1;
	elseif (z <= 2.6e+218)
		tmp = x + (y + (b * (a - 0.5)));
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x + N[(z * N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -6.5e+184], t$95$1, If[LessEqual[z, 2.6e+218], N[(x + N[(y + N[(b * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x + z \cdot \left(1 - \log t\right)\\
\mathbf{if}\;z \leq -6.5 \cdot 10^{+184}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq 2.6 \cdot 10^{+218}:\\
\;\;\;\;x + \left(y + b \cdot \left(a - 0.5\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -6.50000000000000002e184 or 2.60000000000000002e218 < z

    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. Applied rewrites99.9%

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

      \[\leadsto \color{blue}{x + \left(b \cdot \left(a - \frac{1}{2}\right) + z \cdot \left(1 - \log t\right)\right)} \]
    4. Applied rewrites78.4%

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

      \[\leadsto x + \color{blue}{z \cdot \left(1 - \log t\right)} \]
    6. Applied rewrites42.0%

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

    if -6.50000000000000002e184 < z < 2.60000000000000002e218

    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. Applied rewrites78.7%

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

Alternative 9: 79.0% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := z \cdot \left(1 - \log t\right)\\ \mathbf{if}\;z \leq -5.2 \cdot 10^{+186}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 2.65 \cdot 10^{+218}:\\ \;\;\;\;x + \left(y + b \cdot \left(a - 0.5\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (* z (- 1.0 (log t)))))
   (if (<= z -5.2e+186)
     t_1
     (if (<= z 2.65e+218) (+ x (+ y (* b (- a 0.5)))) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = z * (1.0 - log(t));
	double tmp;
	if (z <= -5.2e+186) {
		tmp = t_1;
	} else if (z <= 2.65e+218) {
		tmp = x + (y + (b * (a - 0.5)));
	} else {
		tmp = t_1;
	}
	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 = z * (1.0d0 - log(t))
    if (z <= (-5.2d+186)) then
        tmp = t_1
    else if (z <= 2.65d+218) then
        tmp = x + (y + (b * (a - 0.5d0)))
    else
        tmp = t_1
    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 = z * (1.0 - Math.log(t));
	double tmp;
	if (z <= -5.2e+186) {
		tmp = t_1;
	} else if (z <= 2.65e+218) {
		tmp = x + (y + (b * (a - 0.5)));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	t_1 = z * (1.0 - math.log(t))
	tmp = 0
	if z <= -5.2e+186:
		tmp = t_1
	elif z <= 2.65e+218:
		tmp = x + (y + (b * (a - 0.5)))
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a, b)
	t_1 = Float64(z * Float64(1.0 - log(t)))
	tmp = 0.0
	if (z <= -5.2e+186)
		tmp = t_1;
	elseif (z <= 2.65e+218)
		tmp = Float64(x + Float64(y + Float64(b * Float64(a - 0.5))));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = z * (1.0 - log(t));
	tmp = 0.0;
	if (z <= -5.2e+186)
		tmp = t_1;
	elseif (z <= 2.65e+218)
		tmp = x + (y + (b * (a - 0.5)));
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(z * N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -5.2e+186], t$95$1, If[LessEqual[z, 2.65e+218], N[(x + N[(y + N[(b * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := z \cdot \left(1 - \log t\right)\\
\mathbf{if}\;z \leq -5.2 \cdot 10^{+186}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq 2.65 \cdot 10^{+218}:\\
\;\;\;\;x + \left(y + b \cdot \left(a - 0.5\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -5.2000000000000001e186 or 2.6500000000000001e218 < z

    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 inf

      \[\leadsto \color{blue}{z \cdot \left(1 - \log t\right)} \]
    3. Applied rewrites22.4%

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

    if -5.2000000000000001e186 < z < 2.6500000000000001e218

    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. Applied rewrites78.7%

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

Alternative 10: 78.7% accurate, 2.2× speedup?

\[\begin{array}{l} \\ x + \left(y + b \cdot \left(a - 0.5\right)\right) \end{array} \]
(FPCore (x y z t a b) :precision binary64 (+ x (+ y (* b (- a 0.5)))))
double code(double x, double y, double z, double t, double a, double b) {
	return x + (y + (b * (a - 0.5)));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(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 + (b * (a - 0.5d0)))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	return x + (y + (b * (a - 0.5)));
}
def code(x, y, z, t, a, b):
	return x + (y + (b * (a - 0.5)))
function code(x, y, z, t, a, b)
	return Float64(x + Float64(y + Float64(b * Float64(a - 0.5))))
end
function tmp = code(x, y, z, t, a, b)
	tmp = x + (y + (b * (a - 0.5)));
end
code[x_, y_, z_, t_, a_, b_] := N[(x + N[(y + N[(b * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x + \left(y + b \cdot \left(a - 0.5\right)\right)
\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. Applied rewrites78.7%

    \[\leadsto \color{blue}{x + \left(y + b \cdot \left(a - 0.5\right)\right)} \]
  4. Add Preprocessing

Alternative 11: 58.6% 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^{-125}:\\ \;\;\;\;x + b \cdot \left(a - 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(a - 0.5, b, y\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (<= (- (+ (+ x y) z) (* z (log t))) -1e-125)
   (+ x (* b (- a 0.5)))
   (fma (- a 0.5) b 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-125) {
		tmp = x + (b * (a - 0.5));
	} else {
		tmp = fma((a - 0.5), b, 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-125)
		tmp = Float64(x + Float64(b * Float64(a - 0.5)));
	else
		tmp = fma(Float64(a - 0.5), b, 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-125], N[(x + N[(b * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a - 0.5), $MachinePrecision] * b + 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^{-125}:\\
\;\;\;\;x + b \cdot \left(a - 0.5\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, b, 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))) < -1.00000000000000001e-125

    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. Applied rewrites78.7%

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

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

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

    if -1.00000000000000001e-125 < (-.f64 (+.f64 (+.f64 x y) z) (*.f64 z (log.f64 t)))

    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. Applied rewrites78.7%

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

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

      \[\leadsto y + \color{blue}{b \cdot \left(a - 0.5\right)} \]
    6. Applied rewrites58.6%

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

Alternative 12: 58.2% accurate, 3.0× speedup?

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

\\
\mathsf{fma}\left(a - 0.5, b, y\right)
\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. Applied rewrites78.7%

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

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

    \[\leadsto y + \color{blue}{b \cdot \left(a - 0.5\right)} \]
  6. Applied rewrites58.6%

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

Alternative 13: 51.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(a - 0.5\right) \cdot b\\ t_2 := b \cdot \left(a - 0.5\right)\\ \mathbf{if}\;t\_1 \leq -4 \cdot 10^{+173}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+75}:\\ \;\;\;\;y + -0.5 \cdot b\\ \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 (* b (- a 0.5))))
   (if (<= t_1 -4e+173) t_2 (if (<= t_1 5e+75) (+ y (* -0.5 b)) 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 = b * (a - 0.5);
	double tmp;
	if (t_1 <= -4e+173) {
		tmp = t_2;
	} else if (t_1 <= 5e+75) {
		tmp = y + (-0.5 * b);
	} else {
		tmp = t_2;
	}
	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) :: t_2
    real(8) :: tmp
    t_1 = (a - 0.5d0) * b
    t_2 = b * (a - 0.5d0)
    if (t_1 <= (-4d+173)) then
        tmp = t_2
    else if (t_1 <= 5d+75) then
        tmp = y + ((-0.5d0) * b)
    else
        tmp = t_2
    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 t_2 = b * (a - 0.5);
	double tmp;
	if (t_1 <= -4e+173) {
		tmp = t_2;
	} else if (t_1 <= 5e+75) {
		tmp = y + (-0.5 * b);
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	t_1 = (a - 0.5) * b
	t_2 = b * (a - 0.5)
	tmp = 0
	if t_1 <= -4e+173:
		tmp = t_2
	elif t_1 <= 5e+75:
		tmp = y + (-0.5 * b)
	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(b * Float64(a - 0.5))
	tmp = 0.0
	if (t_1 <= -4e+173)
		tmp = t_2;
	elseif (t_1 <= 5e+75)
		tmp = Float64(y + Float64(-0.5 * b));
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = (a - 0.5) * b;
	t_2 = b * (a - 0.5);
	tmp = 0.0;
	if (t_1 <= -4e+173)
		tmp = t_2;
	elseif (t_1 <= 5e+75)
		tmp = y + (-0.5 * b);
	else
		tmp = t_2;
	end
	tmp_2 = 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[(b * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -4e+173], t$95$2, If[LessEqual[t$95$1, 5e+75], N[(y + N[(-0.5 * b), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left(a - 0.5\right) \cdot b\\
t_2 := b \cdot \left(a - 0.5\right)\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{+173}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+75}:\\
\;\;\;\;y + -0.5 \cdot b\\

\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) < -4.0000000000000001e173 or 5.0000000000000002e75 < (*.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 z around 0

      \[\leadsto \color{blue}{x + \left(y + b \cdot \left(a - \frac{1}{2}\right)\right)} \]
    3. Applied rewrites78.7%

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

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

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

      \[\leadsto b \cdot \left(a - \color{blue}{\frac{1}{2}}\right) \]
    7. Applied rewrites38.0%

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

    if -4.0000000000000001e173 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < 5.0000000000000002e75

    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. Applied rewrites78.7%

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

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

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

      \[\leadsto y + \frac{-1}{2} \cdot \color{blue}{b} \]
    7. Applied rewrites34.7%

      \[\leadsto y + -0.5 \cdot \color{blue}{b} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 14: 38.0% accurate, 4.0× speedup?

\[\begin{array}{l} \\ b \cdot \left(a - 0.5\right) \end{array} \]
(FPCore (x y z t a b) :precision binary64 (* b (- a 0.5)))
double code(double x, double y, double z, double t, double a, double b) {
	return b * (a - 0.5);
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(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 = b * (a - 0.5d0)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	return b * (a - 0.5);
}
def code(x, y, z, t, a, b):
	return b * (a - 0.5)
function code(x, y, z, t, a, b)
	return Float64(b * Float64(a - 0.5))
end
function tmp = code(x, y, z, t, a, b)
	tmp = b * (a - 0.5);
end
code[x_, y_, z_, t_, a_, b_] := N[(b * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
b \cdot \left(a - 0.5\right)
\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. Applied rewrites78.7%

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

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

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

    \[\leadsto b \cdot \left(a - \color{blue}{\frac{1}{2}}\right) \]
  7. Applied rewrites38.0%

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

Alternative 15: 25.8% accurate, 6.6× speedup?

\[\begin{array}{l} \\ a \cdot b \end{array} \]
(FPCore (x y z t a b) :precision binary64 (* a b))
double code(double x, double y, double z, double t, double a, double b) {
	return a * 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 = a * b
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	return a * b;
}
def code(x, y, z, t, a, b):
	return a * b
function code(x, y, z, t, a, b)
	return Float64(a * b)
end
function tmp = code(x, y, z, t, a, b)
	tmp = a * b;
end
code[x_, y_, z_, t_, a_, b_] := N[(a * b), $MachinePrecision]
\begin{array}{l}

\\
a \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. Taylor expanded in a around inf

    \[\leadsto \color{blue}{a \cdot b} \]
  3. Applied rewrites25.8%

    \[\leadsto \color{blue}{a \cdot b} \]
  4. Add Preprocessing

Reproduce

?
herbie shell --seed 2025153 
(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)))