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

Percentage Accurate: 99.8% → 99.8%
Time: 14.7s
Alternatives: 17
Speedup: 1.0×

Specification

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

\\
\left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \left(b - 0.5\right) \cdot \log c\right) + y \cdot i
\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 17 alternatives:

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

Initial Program: 99.8% accurate, 1.0× speedup?

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

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

Alternative 1: 99.8% accurate, 1.0× speedup?

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

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

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

Alternative 2: 94.9% accurate, 0.9× speedup?

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

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

\mathbf{elif}\;a \leq 7 \cdot 10^{+171}:\\
\;\;\;\;t + \left(z + t\_1\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -1.8999999999999999e148 or 6.9999999999999999e171 < a

    1. Initial program 99.8%

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

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

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

    if -1.8999999999999999e148 < a < 6.9999999999999999e171

    1. Initial program 99.8%

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

      \[\leadsto \color{blue}{t + \left(z + \left(i \cdot y + \left(x \cdot \log y + \log c \cdot \left(b - \frac{1}{2}\right)\right)\right)\right)} \]
    3. Applied rewrites84.5%

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

Alternative 3: 93.0% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
t_1 := \log c \cdot \left(b - 0.5\right)\\
\mathbf{if}\;z \leq -4.25 \cdot 10^{+102}:\\
\;\;\;\;t + \left(z + \mathsf{fma}\left(i, y, \mathsf{fma}\left(x, \log y, \log c \cdot -0.5\right)\right)\right)\\

\mathbf{elif}\;z \leq 4.5 \cdot 10^{+62}:\\
\;\;\;\;a + \left(t + \mathsf{fma}\left(i, y, \mathsf{fma}\left(x, \log y, t\_1\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;a + \left(t + \left(z + \mathsf{fma}\left(i, y, t\_1\right)\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -4.2499999999999998e102

    1. Initial program 99.8%

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

      \[\leadsto \color{blue}{t + \left(z + \left(i \cdot y + \left(x \cdot \log y + \log c \cdot \left(b - \frac{1}{2}\right)\right)\right)\right)} \]
    3. Applied rewrites84.5%

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

      \[\leadsto t + \left(z + \mathsf{fma}\left(i, y, \mathsf{fma}\left(x, \log y, \log c \cdot \frac{-1}{2}\right)\right)\right) \]
    5. Applied rewrites69.3%

      \[\leadsto t + \left(z + \mathsf{fma}\left(i, y, \mathsf{fma}\left(x, \log y, \log c \cdot -0.5\right)\right)\right) \]

    if -4.2499999999999998e102 < z < 4.49999999999999999e62

    1. Initial program 99.8%

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

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

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

    if 4.49999999999999999e62 < z

    1. Initial program 99.8%

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

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

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

Alternative 4: 91.4% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_1 := t + \left(z + \mathsf{fma}\left(i, y, \mathsf{fma}\left(x, \log y, \log c \cdot -0.5\right)\right)\right)\\
\mathbf{if}\;x \leq -1.9 \cdot 10^{+219}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq 1.35 \cdot 10^{+95}:\\
\;\;\;\;a + \left(t + \left(z + \mathsf{fma}\left(i, y, \log c \cdot \left(b - 0.5\right)\right)\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.89999999999999998e219 or 1.35e95 < x

    1. Initial program 99.8%

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

      \[\leadsto \color{blue}{t + \left(z + \left(i \cdot y + \left(x \cdot \log y + \log c \cdot \left(b - \frac{1}{2}\right)\right)\right)\right)} \]
    3. Applied rewrites84.5%

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

      \[\leadsto t + \left(z + \mathsf{fma}\left(i, y, \mathsf{fma}\left(x, \log y, \log c \cdot \frac{-1}{2}\right)\right)\right) \]
    5. Applied rewrites69.3%

      \[\leadsto t + \left(z + \mathsf{fma}\left(i, y, \mathsf{fma}\left(x, \log y, \log c \cdot -0.5\right)\right)\right) \]

    if -1.89999999999999998e219 < x < 1.35e95

    1. Initial program 99.8%

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

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

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

Alternative 5: 90.6% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;x \leq 6 \cdot 10^{+147}:\\
\;\;\;\;a + \left(t + \left(z + \mathsf{fma}\left(i, y, t\_1\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;t + \left(z + t\_2\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -3.70000000000000008e124

    1. Initial program 99.8%

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

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

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

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

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

    if -3.70000000000000008e124 < x < 5.99999999999999987e147

    1. Initial program 99.8%

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

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

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

    if 5.99999999999999987e147 < x

    1. Initial program 99.8%

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

      \[\leadsto \color{blue}{t + \left(z + \left(i \cdot y + \left(x \cdot \log y + \log c \cdot \left(b - \frac{1}{2}\right)\right)\right)\right)} \]
    3. Applied rewrites84.5%

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

      \[\leadsto t + \left(z + \mathsf{fma}\left(i, y, \mathsf{fma}\left(x, \log y, \log c \cdot \frac{-1}{2}\right)\right)\right) \]
    5. Applied rewrites69.3%

      \[\leadsto t + \left(z + \mathsf{fma}\left(i, y, \mathsf{fma}\left(x, \log y, \log c \cdot -0.5\right)\right)\right) \]
    6. Taylor expanded in y around 0

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

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

Alternative 6: 90.5% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;x \leq 1.15 \cdot 10^{+140}:\\
\;\;\;\;a + \left(t + \left(z + \mathsf{fma}\left(i, y, t\_1\right)\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -3.70000000000000008e124 or 1.14999999999999995e140 < x

    1. Initial program 99.8%

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

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

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

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

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

    if -3.70000000000000008e124 < x < 1.14999999999999995e140

    1. Initial program 99.8%

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

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

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

Alternative 7: 88.4% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
t_1 := x \cdot \log y\\
\mathbf{if}\;x \leq -1.25 \cdot 10^{+225}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq 6.5 \cdot 10^{+220}:\\
\;\;\;\;a + \left(t + \left(z + \mathsf{fma}\left(i, y, \log c \cdot \left(b - 0.5\right)\right)\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.24999999999999995e225 or 6.5000000000000001e220 < x

    1. Initial program 99.8%

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

      \[\leadsto \color{blue}{t + \left(z + \left(i \cdot y + \left(x \cdot \log y + \log c \cdot \left(b - \frac{1}{2}\right)\right)\right)\right)} \]
    3. Applied rewrites84.5%

      \[\leadsto \color{blue}{t + \left(z + \mathsf{fma}\left(i, y, \mathsf{fma}\left(x, \log y, \log c \cdot \left(b - 0.5\right)\right)\right)\right)} \]
    4. Taylor expanded in x around inf

      \[\leadsto \color{blue}{x \cdot \log y} \]
    5. Applied rewrites16.5%

      \[\leadsto \color{blue}{x \cdot \log y} \]

    if -1.24999999999999995e225 < x < 6.5000000000000001e220

    1. Initial program 99.8%

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

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

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

Alternative 8: 79.5% accurate, 1.2× speedup?

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

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

\mathbf{elif}\;a \leq 7 \cdot 10^{+171}:\\
\;\;\;\;t + \left(z + t\_1\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -1.8999999999999999e148 or 6.9999999999999999e171 < a

    1. Initial program 99.8%

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

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

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

      \[\leadsto a + \left(t + \mathsf{fma}\left(i, y, \log c \cdot \left(b - \frac{1}{2}\right)\right)\right) \]
    5. Applied rewrites69.2%

      \[\leadsto a + \left(t + \mathsf{fma}\left(i, y, \log c \cdot \left(b - 0.5\right)\right)\right) \]

    if -1.8999999999999999e148 < a < 6.9999999999999999e171

    1. Initial program 99.8%

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

      \[\leadsto \color{blue}{t + \left(z + \left(i \cdot y + \left(x \cdot \log y + \log c \cdot \left(b - \frac{1}{2}\right)\right)\right)\right)} \]
    3. Applied rewrites84.5%

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

      \[\leadsto t + \left(z + \mathsf{fma}\left(i, y, \log c \cdot \left(b - \frac{1}{2}\right)\right)\right) \]
    5. Applied rewrites69.4%

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

Alternative 9: 76.7% accurate, 1.2× speedup?

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

\\
\begin{array}{l}
t_1 := t + \left(z + \mathsf{fma}\left(i, y, \log c \cdot -0.5\right)\right)\\
\mathbf{if}\;z \leq -4.25 \cdot 10^{+102}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq 8 \cdot 10^{+137}:\\
\;\;\;\;a + \left(t + \mathsf{fma}\left(i, y, \log c \cdot \left(b - 0.5\right)\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -4.2499999999999998e102 or 8.0000000000000003e137 < z

    1. Initial program 99.8%

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

      \[\leadsto \color{blue}{t + \left(z + \left(i \cdot y + \left(x \cdot \log y + \log c \cdot \left(b - \frac{1}{2}\right)\right)\right)\right)} \]
    3. Applied rewrites84.5%

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

      \[\leadsto t + \left(z + \mathsf{fma}\left(i, y, \log c \cdot \left(b - \frac{1}{2}\right)\right)\right) \]
    5. Applied rewrites69.4%

      \[\leadsto t + \left(z + \mathsf{fma}\left(i, y, \log c \cdot \left(b - 0.5\right)\right)\right) \]
    6. Taylor expanded in b around 0

      \[\leadsto t + \left(z + \mathsf{fma}\left(i, y, \log c \cdot \frac{-1}{2}\right)\right) \]
    7. Applied rewrites54.5%

      \[\leadsto t + \left(z + \mathsf{fma}\left(i, y, \log c \cdot -0.5\right)\right) \]

    if -4.2499999999999998e102 < z < 8.0000000000000003e137

    1. Initial program 99.8%

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

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

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

      \[\leadsto a + \left(t + \mathsf{fma}\left(i, y, \log c \cdot \left(b - \frac{1}{2}\right)\right)\right) \]
    5. Applied rewrites69.2%

      \[\leadsto a + \left(t + \mathsf{fma}\left(i, y, \log c \cdot \left(b - 0.5\right)\right)\right) \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 10: 58.5% accurate, 1.4× speedup?

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

\\
\begin{array}{l}
t_1 := x \cdot \log y\\
\mathbf{if}\;x \leq -1.9 \cdot 10^{+113}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq 1.15 \cdot 10^{+219}:\\
\;\;\;\;t + \left(z + \mathsf{fma}\left(i, y, \log c \cdot -0.5\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.9000000000000002e113 or 1.15e219 < x

    1. Initial program 99.8%

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

      \[\leadsto \color{blue}{t + \left(z + \left(i \cdot y + \left(x \cdot \log y + \log c \cdot \left(b - \frac{1}{2}\right)\right)\right)\right)} \]
    3. Applied rewrites84.5%

      \[\leadsto \color{blue}{t + \left(z + \mathsf{fma}\left(i, y, \mathsf{fma}\left(x, \log y, \log c \cdot \left(b - 0.5\right)\right)\right)\right)} \]
    4. Taylor expanded in x around inf

      \[\leadsto \color{blue}{x \cdot \log y} \]
    5. Applied rewrites16.5%

      \[\leadsto \color{blue}{x \cdot \log y} \]

    if -1.9000000000000002e113 < x < 1.15e219

    1. Initial program 99.8%

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

      \[\leadsto \color{blue}{t + \left(z + \left(i \cdot y + \left(x \cdot \log y + \log c \cdot \left(b - \frac{1}{2}\right)\right)\right)\right)} \]
    3. Applied rewrites84.5%

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

      \[\leadsto t + \left(z + \mathsf{fma}\left(i, y, \log c \cdot \left(b - \frac{1}{2}\right)\right)\right) \]
    5. Applied rewrites69.4%

      \[\leadsto t + \left(z + \mathsf{fma}\left(i, y, \log c \cdot \left(b - 0.5\right)\right)\right) \]
    6. Taylor expanded in b around 0

      \[\leadsto t + \left(z + \mathsf{fma}\left(i, y, \log c \cdot \frac{-1}{2}\right)\right) \]
    7. Applied rewrites54.5%

      \[\leadsto t + \left(z + \mathsf{fma}\left(i, y, \log c \cdot -0.5\right)\right) \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 11: 45.0% accurate, 1.6× speedup?

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

\\
\begin{array}{l}
t_1 := x \cdot \log y\\
\mathbf{if}\;x \leq -1.35 \cdot 10^{+139}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq 1.2 \cdot 10^{+216}:\\
\;\;\;\;\mathsf{fma}\left(\log c, 2, \mathsf{fma}\left(i, y, t\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.3499999999999999e139 or 1.2e216 < x

    1. Initial program 99.8%

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

      \[\leadsto \color{blue}{t + \left(z + \left(i \cdot y + \left(x \cdot \log y + \log c \cdot \left(b - \frac{1}{2}\right)\right)\right)\right)} \]
    3. Applied rewrites84.5%

      \[\leadsto \color{blue}{t + \left(z + \mathsf{fma}\left(i, y, \mathsf{fma}\left(x, \log y, \log c \cdot \left(b - 0.5\right)\right)\right)\right)} \]
    4. Taylor expanded in x around inf

      \[\leadsto \color{blue}{x \cdot \log y} \]
    5. Applied rewrites16.5%

      \[\leadsto \color{blue}{x \cdot \log y} \]

    if -1.3499999999999999e139 < x < 1.2e216

    1. Initial program 99.8%

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

      \[\leadsto \color{blue}{t + \left(z + \left(i \cdot y + \left(x \cdot \log y + \log c \cdot \left(b - \frac{1}{2}\right)\right)\right)\right)} \]
    3. Applied rewrites84.5%

      \[\leadsto \color{blue}{t + \left(z + \mathsf{fma}\left(i, y, \mathsf{fma}\left(x, \log y, \log c \cdot \left(b - 0.5\right)\right)\right)\right)} \]
    4. Applied rewrites65.3%

      \[\leadsto t + \left(z + \mathsf{fma}\left(i, y, \mathsf{fma}\left(x, \log y, \left(\left(b + 0.5\right) \cdot \left(b - 0.5\right)\right) \cdot \frac{\log c}{b + 0.5}\right)\right)\right) \]
    5. Applied rewrites38.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\log c, 2, \mathsf{fma}\left(i, y, t\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 12: 30.2% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 1.1 \cdot 10^{-199}:\\ \;\;\;\;x \cdot \log y\\ \mathbf{elif}\;y \leq 6.6 \cdot 10^{-98}:\\ \;\;\;\;-1 \cdot \left(-1 \cdot t\right)\\ \mathbf{elif}\;y \leq 2.8 \cdot 10^{+72}:\\ \;\;\;\;-1 \cdot \left(-1 \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;-1 \cdot \left(i \cdot \left(-y\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (if (<= y 1.1e-199)
   (* x (log y))
   (if (<= y 6.6e-98)
     (* -1.0 (* -1.0 t))
     (if (<= y 2.8e+72) (* -1.0 (* -1.0 z)) (* -1.0 (* i (- y)))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if (y <= 1.1e-199) {
		tmp = x * log(y);
	} else if (y <= 6.6e-98) {
		tmp = -1.0 * (-1.0 * t);
	} else if (y <= 2.8e+72) {
		tmp = -1.0 * (-1.0 * z);
	} else {
		tmp = -1.0 * (i * -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, c, i)
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), intent (in) :: c
    real(8), intent (in) :: i
    real(8) :: tmp
    if (y <= 1.1d-199) then
        tmp = x * log(y)
    else if (y <= 6.6d-98) then
        tmp = (-1.0d0) * ((-1.0d0) * t)
    else if (y <= 2.8d+72) then
        tmp = (-1.0d0) * ((-1.0d0) * z)
    else
        tmp = (-1.0d0) * (i * -y)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if (y <= 1.1e-199) {
		tmp = x * Math.log(y);
	} else if (y <= 6.6e-98) {
		tmp = -1.0 * (-1.0 * t);
	} else if (y <= 2.8e+72) {
		tmp = -1.0 * (-1.0 * z);
	} else {
		tmp = -1.0 * (i * -y);
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	tmp = 0
	if y <= 1.1e-199:
		tmp = x * math.log(y)
	elif y <= 6.6e-98:
		tmp = -1.0 * (-1.0 * t)
	elif y <= 2.8e+72:
		tmp = -1.0 * (-1.0 * z)
	else:
		tmp = -1.0 * (i * -y)
	return tmp
function code(x, y, z, t, a, b, c, i)
	tmp = 0.0
	if (y <= 1.1e-199)
		tmp = Float64(x * log(y));
	elseif (y <= 6.6e-98)
		tmp = Float64(-1.0 * Float64(-1.0 * t));
	elseif (y <= 2.8e+72)
		tmp = Float64(-1.0 * Float64(-1.0 * z));
	else
		tmp = Float64(-1.0 * Float64(i * Float64(-y)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	tmp = 0.0;
	if (y <= 1.1e-199)
		tmp = x * log(y);
	elseif (y <= 6.6e-98)
		tmp = -1.0 * (-1.0 * t);
	elseif (y <= 2.8e+72)
		tmp = -1.0 * (-1.0 * z);
	else
		tmp = -1.0 * (i * -y);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[y, 1.1e-199], N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6.6e-98], N[(-1.0 * N[(-1.0 * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.8e+72], N[(-1.0 * N[(-1.0 * z), $MachinePrecision]), $MachinePrecision], N[(-1.0 * N[(i * (-y)), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.1 \cdot 10^{-199}:\\
\;\;\;\;x \cdot \log y\\

\mathbf{elif}\;y \leq 6.6 \cdot 10^{-98}:\\
\;\;\;\;-1 \cdot \left(-1 \cdot t\right)\\

\mathbf{elif}\;y \leq 2.8 \cdot 10^{+72}:\\
\;\;\;\;-1 \cdot \left(-1 \cdot z\right)\\

\mathbf{else}:\\
\;\;\;\;-1 \cdot \left(i \cdot \left(-y\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < 1.0999999999999999e-199

    1. Initial program 99.8%

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

      \[\leadsto \color{blue}{t + \left(z + \left(i \cdot y + \left(x \cdot \log y + \log c \cdot \left(b - \frac{1}{2}\right)\right)\right)\right)} \]
    3. Applied rewrites84.5%

      \[\leadsto \color{blue}{t + \left(z + \mathsf{fma}\left(i, y, \mathsf{fma}\left(x, \log y, \log c \cdot \left(b - 0.5\right)\right)\right)\right)} \]
    4. Taylor expanded in x around inf

      \[\leadsto \color{blue}{x \cdot \log y} \]
    5. Applied rewrites16.5%

      \[\leadsto \color{blue}{x \cdot \log y} \]

    if 1.0999999999999999e-199 < y < 6.6000000000000002e-98

    1. Initial program 99.8%

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(i \cdot \mathsf{fma}\left(-1, y, -1 \cdot \frac{a + \left(t + \left(z + \mathsf{fma}\left(x, \log y, \log c \cdot \left(b - 0.5\right)\right)\right)\right)}{i}\right)\right)} \]
    4. Taylor expanded in a around inf

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

      \[\leadsto -1 \cdot \left(-1 \cdot \color{blue}{a}\right) \]
    6. Taylor expanded in t around inf

      \[\leadsto -1 \cdot \left(-1 \cdot \color{blue}{t}\right) \]
    7. Applied rewrites16.1%

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

    if 6.6000000000000002e-98 < y < 2.7999999999999999e72

    1. Initial program 99.8%

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(i \cdot \mathsf{fma}\left(-1, y, -1 \cdot \frac{a + \left(t + \left(z + \mathsf{fma}\left(x, \log y, \log c \cdot \left(b - 0.5\right)\right)\right)\right)}{i}\right)\right)} \]
    4. Taylor expanded in z around inf

      \[\leadsto -1 \cdot \left(-1 \cdot \color{blue}{z}\right) \]
    5. Applied rewrites16.3%

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

    if 2.7999999999999999e72 < y

    1. Initial program 99.8%

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(i \cdot \mathsf{fma}\left(-1, y, -1 \cdot \frac{a + \left(t + \left(z + \mathsf{fma}\left(x, \log y, \log c \cdot \left(b - 0.5\right)\right)\right)\right)}{i}\right)\right)} \]
    4. Taylor expanded in y around inf

      \[\leadsto -1 \cdot \left(i \cdot \left(-1 \cdot \color{blue}{y}\right)\right) \]
    5. Applied rewrites24.7%

      \[\leadsto -1 \cdot \left(i \cdot \left(-1 \cdot \color{blue}{y}\right)\right) \]
    6. Applied rewrites24.7%

      \[\leadsto -1 \cdot \left(i \cdot \left(-y\right)\right) \]
  3. Recombined 4 regimes into one program.
  4. Add Preprocessing

Alternative 13: 30.2% accurate, 2.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 6.6 \cdot 10^{-98}:\\ \;\;\;\;-1 \cdot \left(-1 \cdot t\right)\\ \mathbf{elif}\;y \leq 2.8 \cdot 10^{+72}:\\ \;\;\;\;-1 \cdot \left(-1 \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;-1 \cdot \left(i \cdot \left(-y\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (if (<= y 6.6e-98)
   (* -1.0 (* -1.0 t))
   (if (<= y 2.8e+72) (* -1.0 (* -1.0 z)) (* -1.0 (* i (- y))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if (y <= 6.6e-98) {
		tmp = -1.0 * (-1.0 * t);
	} else if (y <= 2.8e+72) {
		tmp = -1.0 * (-1.0 * z);
	} else {
		tmp = -1.0 * (i * -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, c, i)
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), intent (in) :: c
    real(8), intent (in) :: i
    real(8) :: tmp
    if (y <= 6.6d-98) then
        tmp = (-1.0d0) * ((-1.0d0) * t)
    else if (y <= 2.8d+72) then
        tmp = (-1.0d0) * ((-1.0d0) * z)
    else
        tmp = (-1.0d0) * (i * -y)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if (y <= 6.6e-98) {
		tmp = -1.0 * (-1.0 * t);
	} else if (y <= 2.8e+72) {
		tmp = -1.0 * (-1.0 * z);
	} else {
		tmp = -1.0 * (i * -y);
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	tmp = 0
	if y <= 6.6e-98:
		tmp = -1.0 * (-1.0 * t)
	elif y <= 2.8e+72:
		tmp = -1.0 * (-1.0 * z)
	else:
		tmp = -1.0 * (i * -y)
	return tmp
function code(x, y, z, t, a, b, c, i)
	tmp = 0.0
	if (y <= 6.6e-98)
		tmp = Float64(-1.0 * Float64(-1.0 * t));
	elseif (y <= 2.8e+72)
		tmp = Float64(-1.0 * Float64(-1.0 * z));
	else
		tmp = Float64(-1.0 * Float64(i * Float64(-y)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	tmp = 0.0;
	if (y <= 6.6e-98)
		tmp = -1.0 * (-1.0 * t);
	elseif (y <= 2.8e+72)
		tmp = -1.0 * (-1.0 * z);
	else
		tmp = -1.0 * (i * -y);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[y, 6.6e-98], N[(-1.0 * N[(-1.0 * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.8e+72], N[(-1.0 * N[(-1.0 * z), $MachinePrecision]), $MachinePrecision], N[(-1.0 * N[(i * (-y)), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq 6.6 \cdot 10^{-98}:\\
\;\;\;\;-1 \cdot \left(-1 \cdot t\right)\\

\mathbf{elif}\;y \leq 2.8 \cdot 10^{+72}:\\
\;\;\;\;-1 \cdot \left(-1 \cdot z\right)\\

\mathbf{else}:\\
\;\;\;\;-1 \cdot \left(i \cdot \left(-y\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < 6.6000000000000002e-98

    1. Initial program 99.8%

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(i \cdot \mathsf{fma}\left(-1, y, -1 \cdot \frac{a + \left(t + \left(z + \mathsf{fma}\left(x, \log y, \log c \cdot \left(b - 0.5\right)\right)\right)\right)}{i}\right)\right)} \]
    4. Taylor expanded in a around inf

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

      \[\leadsto -1 \cdot \left(-1 \cdot \color{blue}{a}\right) \]
    6. Taylor expanded in t around inf

      \[\leadsto -1 \cdot \left(-1 \cdot \color{blue}{t}\right) \]
    7. Applied rewrites16.1%

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

    if 6.6000000000000002e-98 < y < 2.7999999999999999e72

    1. Initial program 99.8%

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(i \cdot \mathsf{fma}\left(-1, y, -1 \cdot \frac{a + \left(t + \left(z + \mathsf{fma}\left(x, \log y, \log c \cdot \left(b - 0.5\right)\right)\right)\right)}{i}\right)\right)} \]
    4. Taylor expanded in z around inf

      \[\leadsto -1 \cdot \left(-1 \cdot \color{blue}{z}\right) \]
    5. Applied rewrites16.3%

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

    if 2.7999999999999999e72 < y

    1. Initial program 99.8%

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(i \cdot \mathsf{fma}\left(-1, y, -1 \cdot \frac{a + \left(t + \left(z + \mathsf{fma}\left(x, \log y, \log c \cdot \left(b - 0.5\right)\right)\right)\right)}{i}\right)\right)} \]
    4. Taylor expanded in y around inf

      \[\leadsto -1 \cdot \left(i \cdot \left(-1 \cdot \color{blue}{y}\right)\right) \]
    5. Applied rewrites24.7%

      \[\leadsto -1 \cdot \left(i \cdot \left(-1 \cdot \color{blue}{y}\right)\right) \]
    6. Applied rewrites24.7%

      \[\leadsto -1 \cdot \left(i \cdot \left(-y\right)\right) \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 14: 26.2% accurate, 2.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := -1 \cdot \left(-1 \cdot z\right)\\ \mathbf{if}\;z \leq -5.5 \cdot 10^{+103}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 2.1 \cdot 10^{+152}:\\ \;\;\;\;-1 \cdot \left(-1 \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (let* ((t_1 (* -1.0 (* -1.0 z))))
   (if (<= z -5.5e+103) t_1 (if (<= z 2.1e+152) (* -1.0 (* -1.0 t)) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = -1.0 * (-1.0 * z);
	double tmp;
	if (z <= -5.5e+103) {
		tmp = t_1;
	} else if (z <= 2.1e+152) {
		tmp = -1.0 * (-1.0 * t);
	} 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, c, i)
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), intent (in) :: c
    real(8), intent (in) :: i
    real(8) :: t_1
    real(8) :: tmp
    t_1 = (-1.0d0) * ((-1.0d0) * z)
    if (z <= (-5.5d+103)) then
        tmp = t_1
    else if (z <= 2.1d+152) then
        tmp = (-1.0d0) * ((-1.0d0) * t)
    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 c, double i) {
	double t_1 = -1.0 * (-1.0 * z);
	double tmp;
	if (z <= -5.5e+103) {
		tmp = t_1;
	} else if (z <= 2.1e+152) {
		tmp = -1.0 * (-1.0 * t);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	t_1 = -1.0 * (-1.0 * z)
	tmp = 0
	if z <= -5.5e+103:
		tmp = t_1
	elif z <= 2.1e+152:
		tmp = -1.0 * (-1.0 * t)
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(-1.0 * Float64(-1.0 * z))
	tmp = 0.0
	if (z <= -5.5e+103)
		tmp = t_1;
	elseif (z <= 2.1e+152)
		tmp = Float64(-1.0 * Float64(-1.0 * t));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	t_1 = -1.0 * (-1.0 * z);
	tmp = 0.0;
	if (z <= -5.5e+103)
		tmp = t_1;
	elseif (z <= 2.1e+152)
		tmp = -1.0 * (-1.0 * t);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(-1.0 * N[(-1.0 * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -5.5e+103], t$95$1, If[LessEqual[z, 2.1e+152], N[(-1.0 * N[(-1.0 * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq 2.1 \cdot 10^{+152}:\\
\;\;\;\;-1 \cdot \left(-1 \cdot t\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -5.50000000000000001e103 or 2.1000000000000002e152 < z

    1. Initial program 99.8%

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(i \cdot \mathsf{fma}\left(-1, y, -1 \cdot \frac{a + \left(t + \left(z + \mathsf{fma}\left(x, \log y, \log c \cdot \left(b - 0.5\right)\right)\right)\right)}{i}\right)\right)} \]
    4. Taylor expanded in z around inf

      \[\leadsto -1 \cdot \left(-1 \cdot \color{blue}{z}\right) \]
    5. Applied rewrites16.3%

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

    if -5.50000000000000001e103 < z < 2.1000000000000002e152

    1. Initial program 99.8%

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(i \cdot \mathsf{fma}\left(-1, y, -1 \cdot \frac{a + \left(t + \left(z + \mathsf{fma}\left(x, \log y, \log c \cdot \left(b - 0.5\right)\right)\right)\right)}{i}\right)\right)} \]
    4. Taylor expanded in a around inf

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

      \[\leadsto -1 \cdot \left(-1 \cdot \color{blue}{a}\right) \]
    6. Taylor expanded in t around inf

      \[\leadsto -1 \cdot \left(-1 \cdot \color{blue}{t}\right) \]
    7. Applied rewrites16.1%

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

Alternative 15: 26.1% accurate, 2.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := -1 \cdot \left(-a\right)\\ \mathbf{if}\;a \leq -2.8 \cdot 10^{+104}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;a \leq 3.4 \cdot 10^{+133}:\\ \;\;\;\;-1 \cdot \left(-1 \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (let* ((t_1 (* -1.0 (- a))))
   (if (<= a -2.8e+104) t_1 (if (<= a 3.4e+133) (* -1.0 (* -1.0 t)) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = -1.0 * -a;
	double tmp;
	if (a <= -2.8e+104) {
		tmp = t_1;
	} else if (a <= 3.4e+133) {
		tmp = -1.0 * (-1.0 * t);
	} 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, c, i)
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), intent (in) :: c
    real(8), intent (in) :: i
    real(8) :: t_1
    real(8) :: tmp
    t_1 = (-1.0d0) * -a
    if (a <= (-2.8d+104)) then
        tmp = t_1
    else if (a <= 3.4d+133) then
        tmp = (-1.0d0) * ((-1.0d0) * t)
    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 c, double i) {
	double t_1 = -1.0 * -a;
	double tmp;
	if (a <= -2.8e+104) {
		tmp = t_1;
	} else if (a <= 3.4e+133) {
		tmp = -1.0 * (-1.0 * t);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	t_1 = -1.0 * -a
	tmp = 0
	if a <= -2.8e+104:
		tmp = t_1
	elif a <= 3.4e+133:
		tmp = -1.0 * (-1.0 * t)
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(-1.0 * Float64(-a))
	tmp = 0.0
	if (a <= -2.8e+104)
		tmp = t_1;
	elseif (a <= 3.4e+133)
		tmp = Float64(-1.0 * Float64(-1.0 * t));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	t_1 = -1.0 * -a;
	tmp = 0.0;
	if (a <= -2.8e+104)
		tmp = t_1;
	elseif (a <= 3.4e+133)
		tmp = -1.0 * (-1.0 * t);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(-1.0 * (-a)), $MachinePrecision]}, If[LessEqual[a, -2.8e+104], t$95$1, If[LessEqual[a, 3.4e+133], N[(-1.0 * N[(-1.0 * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := -1 \cdot \left(-a\right)\\
\mathbf{if}\;a \leq -2.8 \cdot 10^{+104}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;a \leq 3.4 \cdot 10^{+133}:\\
\;\;\;\;-1 \cdot \left(-1 \cdot t\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -2.8e104 or 3.39999999999999987e133 < a

    1. Initial program 99.8%

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(i \cdot \mathsf{fma}\left(-1, y, -1 \cdot \frac{a + \left(t + \left(z + \mathsf{fma}\left(x, \log y, \log c \cdot \left(b - 0.5\right)\right)\right)\right)}{i}\right)\right)} \]
    4. Taylor expanded in a around inf

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

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

      \[\leadsto -1 \cdot \left(-a\right) \]

    if -2.8e104 < a < 3.39999999999999987e133

    1. Initial program 99.8%

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(i \cdot \mathsf{fma}\left(-1, y, -1 \cdot \frac{a + \left(t + \left(z + \mathsf{fma}\left(x, \log y, \log c \cdot \left(b - 0.5\right)\right)\right)\right)}{i}\right)\right)} \]
    4. Taylor expanded in a around inf

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

      \[\leadsto -1 \cdot \left(-1 \cdot \color{blue}{a}\right) \]
    6. Taylor expanded in t around inf

      \[\leadsto -1 \cdot \left(-1 \cdot \color{blue}{t}\right) \]
    7. Applied rewrites16.1%

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

Alternative 16: 16.4% accurate, 7.6× speedup?

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

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

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

\\
-1 \cdot \left(-a\right)
\end{array}
Derivation
  1. Initial program 99.8%

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

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

    \[\leadsto \color{blue}{-1 \cdot \left(i \cdot \mathsf{fma}\left(-1, y, -1 \cdot \frac{a + \left(t + \left(z + \mathsf{fma}\left(x, \log y, \log c \cdot \left(b - 0.5\right)\right)\right)\right)}{i}\right)\right)} \]
  4. Taylor expanded in a around inf

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

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

    \[\leadsto -1 \cdot \left(-a\right) \]
  7. Add Preprocessing

Alternative 17: 2.2% accurate, 9.5× speedup?

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

\\
-1 \cdot t
\end{array}
Derivation
  1. Initial program 99.8%

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

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

    \[\leadsto \color{blue}{-1 \cdot \left(i \cdot \mathsf{fma}\left(-1, y, -1 \cdot \frac{a + \left(t + \left(z + \mathsf{fma}\left(x, \log y, \log c \cdot \left(b - 0.5\right)\right)\right)\right)}{i}\right)\right)} \]
  4. Taylor expanded in a around inf

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

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

    \[\leadsto -1 \cdot \left(-a\right) \]
  7. Taylor expanded in t around inf

    \[\leadsto -1 \cdot \color{blue}{t} \]
  8. Applied rewrites2.2%

    \[\leadsto -1 \cdot \color{blue}{t} \]
  9. Add Preprocessing

Reproduce

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