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

Percentage Accurate: 99.8% → 99.8%
Time: 11.1s
Alternatives: 13
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}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 13 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.9%

    \[\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
  3. Add Preprocessing

Alternative 2: 30.6% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \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\\ \mathbf{if}\;t\_1 \leq -\infty:\\ \;\;\;\;i \cdot y\\ \mathbf{elif}\;t\_1 \leq -1 \cdot 10^{+26}:\\ \;\;\;\;\frac{z}{x} \cdot x\\ \mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+306}:\\ \;\;\;\;\mathsf{fma}\left(\frac{t}{a}, a, a\right)\\ \mathbf{else}:\\ \;\;\;\;i \cdot y\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (let* ((t_1
         (+
          (+ (+ (+ (+ (* x (log y)) z) t) a) (* (- b 0.5) (log c)))
          (* y i))))
   (if (<= t_1 (- INFINITY))
     (* i y)
     (if (<= t_1 -1e+26)
       (* (/ z x) x)
       (if (<= t_1 5e+306) (fma (/ t a) a a) (* i y))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = (((((x * log(y)) + z) + t) + a) + ((b - 0.5) * log(c))) + (y * i);
	double tmp;
	if (t_1 <= -((double) INFINITY)) {
		tmp = i * y;
	} else if (t_1 <= -1e+26) {
		tmp = (z / x) * x;
	} else if (t_1 <= 5e+306) {
		tmp = fma((t / a), a, a);
	} else {
		tmp = i * y;
	}
	return tmp;
}
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(Float64(Float64(Float64(Float64(Float64(x * log(y)) + z) + t) + a) + Float64(Float64(b - 0.5) * log(c))) + Float64(y * i))
	tmp = 0.0
	if (t_1 <= Float64(-Inf))
		tmp = Float64(i * y);
	elseif (t_1 <= -1e+26)
		tmp = Float64(Float64(z / x) * x);
	elseif (t_1 <= 5e+306)
		tmp = fma(Float64(t / a), a, a);
	else
		tmp = Float64(i * y);
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = 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]}, If[LessEqual[t$95$1, (-Infinity)], N[(i * y), $MachinePrecision], If[LessEqual[t$95$1, -1e+26], N[(N[(z / x), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[t$95$1, 5e+306], N[(N[(t / a), $MachinePrecision] * a + a), $MachinePrecision], N[(i * y), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \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\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;i \cdot y\\

\mathbf{elif}\;t\_1 \leq -1 \cdot 10^{+26}:\\
\;\;\;\;\frac{z}{x} \cdot x\\

\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+306}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{a}, a, a\right)\\

\mathbf{else}:\\
\;\;\;\;i \cdot y\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (+.f64 (+.f64 (+.f64 (+.f64 (+.f64 (*.f64 x (log.f64 y)) z) t) a) (*.f64 (-.f64 b #s(literal 1/2 binary64)) (log.f64 c))) (*.f64 y i)) < -inf.0 or 4.99999999999999993e306 < (+.f64 (+.f64 (+.f64 (+.f64 (+.f64 (*.f64 x (log.f64 y)) z) t) a) (*.f64 (-.f64 b #s(literal 1/2 binary64)) (log.f64 c))) (*.f64 y i))

    1. Initial program 100.0%

      \[\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
    3. Taylor expanded in y around inf

      \[\leadsto \color{blue}{i \cdot y} \]
    4. Step-by-step derivation
      1. lower-*.f6491.0

        \[\leadsto \color{blue}{i \cdot y} \]
    5. Applied rewrites91.0%

      \[\leadsto \color{blue}{i \cdot y} \]

    if -inf.0 < (+.f64 (+.f64 (+.f64 (+.f64 (+.f64 (*.f64 x (log.f64 y)) z) t) a) (*.f64 (-.f64 b #s(literal 1/2 binary64)) (log.f64 c))) (*.f64 y i)) < -1.00000000000000005e26

    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
    3. Taylor expanded in x around inf

      \[\leadsto \color{blue}{x \cdot \left(\log y + \left(\frac{a}{x} + \left(\frac{t}{x} + \left(\frac{z}{x} + \left(\frac{i \cdot y}{x} + \frac{\log c \cdot \left(b - \frac{1}{2}\right)}{x}\right)\right)\right)\right)\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

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

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

      \[\leadsto \frac{z}{x} \cdot x \]
    7. Step-by-step derivation
      1. Applied rewrites8.6%

        \[\leadsto \frac{z}{x} \cdot x \]

      if -1.00000000000000005e26 < (+.f64 (+.f64 (+.f64 (+.f64 (+.f64 (*.f64 x (log.f64 y)) z) t) a) (*.f64 (-.f64 b #s(literal 1/2 binary64)) (log.f64 c))) (*.f64 y i)) < 4.99999999999999993e306

      1. Initial program 99.9%

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

        \[\leadsto \color{blue}{a \cdot \left(1 + \left(\frac{t}{a} + \left(\frac{z}{a} + \left(\frac{i \cdot y}{a} + \left(\frac{x \cdot \log y}{a} + \frac{\log c \cdot \left(b - \frac{1}{2}\right)}{a}\right)\right)\right)\right)\right)} \]
      4. Step-by-step derivation
        1. distribute-rgt-inN/A

          \[\leadsto \color{blue}{1 \cdot a + \left(\frac{t}{a} + \left(\frac{z}{a} + \left(\frac{i \cdot y}{a} + \left(\frac{x \cdot \log y}{a} + \frac{\log c \cdot \left(b - \frac{1}{2}\right)}{a}\right)\right)\right)\right) \cdot a} \]
        2. *-lft-identityN/A

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

          \[\leadsto \color{blue}{\left(\frac{t}{a} + \left(\frac{z}{a} + \left(\frac{i \cdot y}{a} + \left(\frac{x \cdot \log y}{a} + \frac{\log c \cdot \left(b - \frac{1}{2}\right)}{a}\right)\right)\right)\right) \cdot a + a} \]
        4. lower-fma.f64N/A

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

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

        \[\leadsto \mathsf{fma}\left(\frac{t}{a}, a, a\right) \]
      7. Step-by-step derivation
        1. Applied rewrites34.3%

          \[\leadsto \mathsf{fma}\left(\frac{t}{a}, a, a\right) \]
      8. Recombined 3 regimes into one program.
      9. Add Preprocessing

      Alternative 3: 23.0% accurate, 0.3× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_1 := \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\\ \mathbf{if}\;t\_1 \leq -\infty:\\ \;\;\;\;i \cdot y\\ \mathbf{elif}\;t\_1 \leq -1 \cdot 10^{+26}:\\ \;\;\;\;\frac{z}{x} \cdot x\\ \mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+306}:\\ \;\;\;\;\frac{a}{x} \cdot x\\ \mathbf{else}:\\ \;\;\;\;i \cdot y\\ \end{array} \end{array} \]
      (FPCore (x y z t a b c i)
       :precision binary64
       (let* ((t_1
               (+
                (+ (+ (+ (+ (* x (log y)) z) t) a) (* (- b 0.5) (log c)))
                (* y i))))
         (if (<= t_1 (- INFINITY))
           (* i y)
           (if (<= t_1 -1e+26)
             (* (/ z x) x)
             (if (<= t_1 5e+306) (* (/ a x) x) (* i y))))))
      double code(double x, double y, double z, double t, double a, double b, double c, double i) {
      	double t_1 = (((((x * log(y)) + z) + t) + a) + ((b - 0.5) * log(c))) + (y * i);
      	double tmp;
      	if (t_1 <= -((double) INFINITY)) {
      		tmp = i * y;
      	} else if (t_1 <= -1e+26) {
      		tmp = (z / x) * x;
      	} else if (t_1 <= 5e+306) {
      		tmp = (a / x) * x;
      	} else {
      		tmp = i * y;
      	}
      	return tmp;
      }
      
      public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
      	double t_1 = (((((x * Math.log(y)) + z) + t) + a) + ((b - 0.5) * Math.log(c))) + (y * i);
      	double tmp;
      	if (t_1 <= -Double.POSITIVE_INFINITY) {
      		tmp = i * y;
      	} else if (t_1 <= -1e+26) {
      		tmp = (z / x) * x;
      	} else if (t_1 <= 5e+306) {
      		tmp = (a / x) * x;
      	} else {
      		tmp = i * y;
      	}
      	return tmp;
      }
      
      def code(x, y, z, t, a, b, c, i):
      	t_1 = (((((x * math.log(y)) + z) + t) + a) + ((b - 0.5) * math.log(c))) + (y * i)
      	tmp = 0
      	if t_1 <= -math.inf:
      		tmp = i * y
      	elif t_1 <= -1e+26:
      		tmp = (z / x) * x
      	elif t_1 <= 5e+306:
      		tmp = (a / x) * x
      	else:
      		tmp = i * y
      	return tmp
      
      function code(x, y, z, t, a, b, c, i)
      	t_1 = Float64(Float64(Float64(Float64(Float64(Float64(x * log(y)) + z) + t) + a) + Float64(Float64(b - 0.5) * log(c))) + Float64(y * i))
      	tmp = 0.0
      	if (t_1 <= Float64(-Inf))
      		tmp = Float64(i * y);
      	elseif (t_1 <= -1e+26)
      		tmp = Float64(Float64(z / x) * x);
      	elseif (t_1 <= 5e+306)
      		tmp = Float64(Float64(a / x) * x);
      	else
      		tmp = Float64(i * y);
      	end
      	return tmp
      end
      
      function tmp_2 = code(x, y, z, t, a, b, c, i)
      	t_1 = (((((x * log(y)) + z) + t) + a) + ((b - 0.5) * log(c))) + (y * i);
      	tmp = 0.0;
      	if (t_1 <= -Inf)
      		tmp = i * y;
      	elseif (t_1 <= -1e+26)
      		tmp = (z / x) * x;
      	elseif (t_1 <= 5e+306)
      		tmp = (a / x) * x;
      	else
      		tmp = i * y;
      	end
      	tmp_2 = tmp;
      end
      
      code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = 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]}, If[LessEqual[t$95$1, (-Infinity)], N[(i * y), $MachinePrecision], If[LessEqual[t$95$1, -1e+26], N[(N[(z / x), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[t$95$1, 5e+306], N[(N[(a / x), $MachinePrecision] * x), $MachinePrecision], N[(i * y), $MachinePrecision]]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_1 := \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\\
      \mathbf{if}\;t\_1 \leq -\infty:\\
      \;\;\;\;i \cdot y\\
      
      \mathbf{elif}\;t\_1 \leq -1 \cdot 10^{+26}:\\
      \;\;\;\;\frac{z}{x} \cdot x\\
      
      \mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+306}:\\
      \;\;\;\;\frac{a}{x} \cdot x\\
      
      \mathbf{else}:\\
      \;\;\;\;i \cdot y\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if (+.f64 (+.f64 (+.f64 (+.f64 (+.f64 (*.f64 x (log.f64 y)) z) t) a) (*.f64 (-.f64 b #s(literal 1/2 binary64)) (log.f64 c))) (*.f64 y i)) < -inf.0 or 4.99999999999999993e306 < (+.f64 (+.f64 (+.f64 (+.f64 (+.f64 (*.f64 x (log.f64 y)) z) t) a) (*.f64 (-.f64 b #s(literal 1/2 binary64)) (log.f64 c))) (*.f64 y i))

        1. Initial program 100.0%

          \[\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
        3. Taylor expanded in y around inf

          \[\leadsto \color{blue}{i \cdot y} \]
        4. Step-by-step derivation
          1. lower-*.f6491.0

            \[\leadsto \color{blue}{i \cdot y} \]
        5. Applied rewrites91.0%

          \[\leadsto \color{blue}{i \cdot y} \]

        if -inf.0 < (+.f64 (+.f64 (+.f64 (+.f64 (+.f64 (*.f64 x (log.f64 y)) z) t) a) (*.f64 (-.f64 b #s(literal 1/2 binary64)) (log.f64 c))) (*.f64 y i)) < -1.00000000000000005e26

        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
        3. Taylor expanded in x around inf

          \[\leadsto \color{blue}{x \cdot \left(\log y + \left(\frac{a}{x} + \left(\frac{t}{x} + \left(\frac{z}{x} + \left(\frac{i \cdot y}{x} + \frac{\log c \cdot \left(b - \frac{1}{2}\right)}{x}\right)\right)\right)\right)\right)} \]
        4. Step-by-step derivation
          1. *-commutativeN/A

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

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

          \[\leadsto \frac{z}{x} \cdot x \]
        7. Step-by-step derivation
          1. Applied rewrites8.6%

            \[\leadsto \frac{z}{x} \cdot x \]

          if -1.00000000000000005e26 < (+.f64 (+.f64 (+.f64 (+.f64 (+.f64 (*.f64 x (log.f64 y)) z) t) a) (*.f64 (-.f64 b #s(literal 1/2 binary64)) (log.f64 c))) (*.f64 y i)) < 4.99999999999999993e306

          1. Initial program 99.9%

            \[\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
          3. Taylor expanded in x around inf

            \[\leadsto \color{blue}{x \cdot \left(\log y + \left(\frac{a}{x} + \left(\frac{t}{x} + \left(\frac{z}{x} + \left(\frac{i \cdot y}{x} + \frac{\log c \cdot \left(b - \frac{1}{2}\right)}{x}\right)\right)\right)\right)\right)} \]
          4. Step-by-step derivation
            1. *-commutativeN/A

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

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

            \[\leadsto \frac{a}{x} \cdot x \]
          7. Step-by-step derivation
            1. Applied rewrites9.2%

              \[\leadsto \frac{a}{x} \cdot x \]
          8. Recombined 3 regimes into one program.
          9. Add Preprocessing

          Alternative 4: 37.3% accurate, 0.5× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} t_1 := \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\\ \mathbf{if}\;t\_1 \leq -\infty \lor \neg \left(t\_1 \leq 5 \cdot 10^{+306}\right):\\ \;\;\;\;i \cdot y\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{z}{a}, a, a\right)\\ \end{array} \end{array} \]
          (FPCore (x y z t a b c i)
           :precision binary64
           (let* ((t_1
                   (+
                    (+ (+ (+ (+ (* x (log y)) z) t) a) (* (- b 0.5) (log c)))
                    (* y i))))
             (if (or (<= t_1 (- INFINITY)) (not (<= t_1 5e+306)))
               (* i y)
               (fma (/ z a) a a))))
          double code(double x, double y, double z, double t, double a, double b, double c, double i) {
          	double t_1 = (((((x * log(y)) + z) + t) + a) + ((b - 0.5) * log(c))) + (y * i);
          	double tmp;
          	if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 5e+306)) {
          		tmp = i * y;
          	} else {
          		tmp = fma((z / a), a, a);
          	}
          	return tmp;
          }
          
          function code(x, y, z, t, a, b, c, i)
          	t_1 = Float64(Float64(Float64(Float64(Float64(Float64(x * log(y)) + z) + t) + a) + Float64(Float64(b - 0.5) * log(c))) + Float64(y * i))
          	tmp = 0.0
          	if ((t_1 <= Float64(-Inf)) || !(t_1 <= 5e+306))
          		tmp = Float64(i * y);
          	else
          		tmp = fma(Float64(z / a), a, a);
          	end
          	return tmp
          end
          
          code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = 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]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 5e+306]], $MachinePrecision]], N[(i * y), $MachinePrecision], N[(N[(z / a), $MachinePrecision] * a + a), $MachinePrecision]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          t_1 := \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\\
          \mathbf{if}\;t\_1 \leq -\infty \lor \neg \left(t\_1 \leq 5 \cdot 10^{+306}\right):\\
          \;\;\;\;i \cdot y\\
          
          \mathbf{else}:\\
          \;\;\;\;\mathsf{fma}\left(\frac{z}{a}, a, a\right)\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if (+.f64 (+.f64 (+.f64 (+.f64 (+.f64 (*.f64 x (log.f64 y)) z) t) a) (*.f64 (-.f64 b #s(literal 1/2 binary64)) (log.f64 c))) (*.f64 y i)) < -inf.0 or 4.99999999999999993e306 < (+.f64 (+.f64 (+.f64 (+.f64 (+.f64 (*.f64 x (log.f64 y)) z) t) a) (*.f64 (-.f64 b #s(literal 1/2 binary64)) (log.f64 c))) (*.f64 y i))

            1. Initial program 100.0%

              \[\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
            3. Taylor expanded in y around inf

              \[\leadsto \color{blue}{i \cdot y} \]
            4. Step-by-step derivation
              1. lower-*.f6491.0

                \[\leadsto \color{blue}{i \cdot y} \]
            5. Applied rewrites91.0%

              \[\leadsto \color{blue}{i \cdot y} \]

            if -inf.0 < (+.f64 (+.f64 (+.f64 (+.f64 (+.f64 (*.f64 x (log.f64 y)) z) t) a) (*.f64 (-.f64 b #s(literal 1/2 binary64)) (log.f64 c))) (*.f64 y i)) < 4.99999999999999993e306

            1. Initial program 99.9%

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

              \[\leadsto \color{blue}{a \cdot \left(1 + \left(\frac{t}{a} + \left(\frac{z}{a} + \left(\frac{i \cdot y}{a} + \left(\frac{x \cdot \log y}{a} + \frac{\log c \cdot \left(b - \frac{1}{2}\right)}{a}\right)\right)\right)\right)\right)} \]
            4. Step-by-step derivation
              1. distribute-rgt-inN/A

                \[\leadsto \color{blue}{1 \cdot a + \left(\frac{t}{a} + \left(\frac{z}{a} + \left(\frac{i \cdot y}{a} + \left(\frac{x \cdot \log y}{a} + \frac{\log c \cdot \left(b - \frac{1}{2}\right)}{a}\right)\right)\right)\right) \cdot a} \]
              2. *-lft-identityN/A

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

                \[\leadsto \color{blue}{\left(\frac{t}{a} + \left(\frac{z}{a} + \left(\frac{i \cdot y}{a} + \left(\frac{x \cdot \log y}{a} + \frac{\log c \cdot \left(b - \frac{1}{2}\right)}{a}\right)\right)\right)\right) \cdot a + a} \]
              4. lower-fma.f64N/A

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

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

              \[\leadsto \mathsf{fma}\left(\frac{z}{a}, a, a\right) \]
            7. Step-by-step derivation
              1. Applied rewrites29.9%

                \[\leadsto \mathsf{fma}\left(\frac{z}{a}, a, a\right) \]
            8. Recombined 2 regimes into one program.
            9. Final simplification40.2%

              \[\leadsto \begin{array}{l} \mathbf{if}\;\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 \leq -\infty \lor \neg \left(\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 \leq 5 \cdot 10^{+306}\right):\\ \;\;\;\;i \cdot y\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{z}{a}, a, a\right)\\ \end{array} \]
            10. Add Preprocessing

            Alternative 5: 23.5% accurate, 0.5× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} t_1 := \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\\ \mathbf{if}\;t\_1 \leq 10^{+123} \lor \neg \left(t\_1 \leq 5 \cdot 10^{+306}\right):\\ \;\;\;\;i \cdot y\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{x} \cdot x\\ \end{array} \end{array} \]
            (FPCore (x y z t a b c i)
             :precision binary64
             (let* ((t_1
                     (+
                      (+ (+ (+ (+ (* x (log y)) z) t) a) (* (- b 0.5) (log c)))
                      (* y i))))
               (if (or (<= t_1 1e+123) (not (<= t_1 5e+306))) (* i y) (* (/ a x) x))))
            double code(double x, double y, double z, double t, double a, double b, double c, double i) {
            	double t_1 = (((((x * log(y)) + z) + t) + a) + ((b - 0.5) * log(c))) + (y * i);
            	double tmp;
            	if ((t_1 <= 1e+123) || !(t_1 <= 5e+306)) {
            		tmp = i * y;
            	} else {
            		tmp = (a / x) * x;
            	}
            	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 = (((((x * log(y)) + z) + t) + a) + ((b - 0.5d0) * log(c))) + (y * i)
                if ((t_1 <= 1d+123) .or. (.not. (t_1 <= 5d+306))) then
                    tmp = i * y
                else
                    tmp = (a / x) * x
                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 = (((((x * Math.log(y)) + z) + t) + a) + ((b - 0.5) * Math.log(c))) + (y * i);
            	double tmp;
            	if ((t_1 <= 1e+123) || !(t_1 <= 5e+306)) {
            		tmp = i * y;
            	} else {
            		tmp = (a / x) * x;
            	}
            	return tmp;
            }
            
            def code(x, y, z, t, a, b, c, i):
            	t_1 = (((((x * math.log(y)) + z) + t) + a) + ((b - 0.5) * math.log(c))) + (y * i)
            	tmp = 0
            	if (t_1 <= 1e+123) or not (t_1 <= 5e+306):
            		tmp = i * y
            	else:
            		tmp = (a / x) * x
            	return tmp
            
            function code(x, y, z, t, a, b, c, i)
            	t_1 = Float64(Float64(Float64(Float64(Float64(Float64(x * log(y)) + z) + t) + a) + Float64(Float64(b - 0.5) * log(c))) + Float64(y * i))
            	tmp = 0.0
            	if ((t_1 <= 1e+123) || !(t_1 <= 5e+306))
            		tmp = Float64(i * y);
            	else
            		tmp = Float64(Float64(a / x) * x);
            	end
            	return tmp
            end
            
            function tmp_2 = code(x, y, z, t, a, b, c, i)
            	t_1 = (((((x * log(y)) + z) + t) + a) + ((b - 0.5) * log(c))) + (y * i);
            	tmp = 0.0;
            	if ((t_1 <= 1e+123) || ~((t_1 <= 5e+306)))
            		tmp = i * y;
            	else
            		tmp = (a / x) * x;
            	end
            	tmp_2 = tmp;
            end
            
            code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = 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]}, If[Or[LessEqual[t$95$1, 1e+123], N[Not[LessEqual[t$95$1, 5e+306]], $MachinePrecision]], N[(i * y), $MachinePrecision], N[(N[(a / x), $MachinePrecision] * x), $MachinePrecision]]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            t_1 := \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\\
            \mathbf{if}\;t\_1 \leq 10^{+123} \lor \neg \left(t\_1 \leq 5 \cdot 10^{+306}\right):\\
            \;\;\;\;i \cdot y\\
            
            \mathbf{else}:\\
            \;\;\;\;\frac{a}{x} \cdot x\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if (+.f64 (+.f64 (+.f64 (+.f64 (+.f64 (*.f64 x (log.f64 y)) z) t) a) (*.f64 (-.f64 b #s(literal 1/2 binary64)) (log.f64 c))) (*.f64 y i)) < 9.99999999999999978e122 or 4.99999999999999993e306 < (+.f64 (+.f64 (+.f64 (+.f64 (+.f64 (*.f64 x (log.f64 y)) z) t) a) (*.f64 (-.f64 b #s(literal 1/2 binary64)) (log.f64 c))) (*.f64 y i))

              1. Initial program 99.9%

                \[\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
              3. Taylor expanded in y around inf

                \[\leadsto \color{blue}{i \cdot y} \]
              4. Step-by-step derivation
                1. lower-*.f6437.9

                  \[\leadsto \color{blue}{i \cdot y} \]
              5. Applied rewrites37.9%

                \[\leadsto \color{blue}{i \cdot y} \]

              if 9.99999999999999978e122 < (+.f64 (+.f64 (+.f64 (+.f64 (+.f64 (*.f64 x (log.f64 y)) z) t) a) (*.f64 (-.f64 b #s(literal 1/2 binary64)) (log.f64 c))) (*.f64 y i)) < 4.99999999999999993e306

              1. Initial program 99.9%

                \[\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
              3. Taylor expanded in x around inf

                \[\leadsto \color{blue}{x \cdot \left(\log y + \left(\frac{a}{x} + \left(\frac{t}{x} + \left(\frac{z}{x} + \left(\frac{i \cdot y}{x} + \frac{\log c \cdot \left(b - \frac{1}{2}\right)}{x}\right)\right)\right)\right)\right)} \]
              4. Step-by-step derivation
                1. *-commutativeN/A

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

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

                \[\leadsto \frac{a}{x} \cdot x \]
              7. Step-by-step derivation
                1. Applied rewrites10.1%

                  \[\leadsto \frac{a}{x} \cdot x \]
              8. Recombined 2 regimes into one program.
              9. Final simplification26.7%

                \[\leadsto \begin{array}{l} \mathbf{if}\;\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 \leq 10^{+123} \lor \neg \left(\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 \leq 5 \cdot 10^{+306}\right):\\ \;\;\;\;i \cdot y\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{x} \cdot x\\ \end{array} \]
              10. Add Preprocessing

              Alternative 6: 91.9% accurate, 1.0× speedup?

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

                1. Initial program 99.9%

                  \[\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
                3. Taylor expanded in t around 0

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

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

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

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

                  \[\leadsto \mathsf{fma}\left(i, y, \mathsf{fma}\left(\log y, x, z \cdot \left(1 + \frac{\log c \cdot \left(b - \frac{1}{2}\right)}{z}\right)\right)\right) + a \]
                7. Step-by-step derivation
                  1. Applied rewrites85.5%

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

                    \[\leadsto \mathsf{fma}\left(i, y, \mathsf{fma}\left(\log y, x, 1 \cdot z\right)\right) + a \]
                  3. Step-by-step derivation
                    1. Applied rewrites85.1%

                      \[\leadsto \mathsf{fma}\left(i, y, \mathsf{fma}\left(\log y, x, 1 \cdot z\right)\right) + a \]

                    if -1.14999999999999997e63 < x < 4.80000000000000048e130

                    1. Initial program 99.9%

                      \[\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
                    3. 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)} \]
                    4. Step-by-step derivation
                      1. associate-+r+N/A

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

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

                        \[\leadsto \color{blue}{\left(a + t\right)} + \left(z + \left(i \cdot y + \log c \cdot \left(b - \frac{1}{2}\right)\right)\right) \]
                      4. associate-+r+N/A

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

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

                        \[\leadsto \left(a + t\right) + \left(\color{blue}{\left(b - \frac{1}{2}\right) \cdot \log c} + \left(z + i \cdot y\right)\right) \]
                      7. lower-fma.f64N/A

                        \[\leadsto \left(a + t\right) + \color{blue}{\mathsf{fma}\left(b - \frac{1}{2}, \log c, z + i \cdot y\right)} \]
                      8. lower--.f64N/A

                        \[\leadsto \left(a + t\right) + \mathsf{fma}\left(\color{blue}{b - \frac{1}{2}}, \log c, z + i \cdot y\right) \]
                      9. lower-log.f64N/A

                        \[\leadsto \left(a + t\right) + \mathsf{fma}\left(b - \frac{1}{2}, \color{blue}{\log c}, z + i \cdot y\right) \]
                      10. +-commutativeN/A

                        \[\leadsto \left(a + t\right) + \mathsf{fma}\left(b - \frac{1}{2}, \log c, \color{blue}{i \cdot y + z}\right) \]
                      11. lower-fma.f6497.3

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

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

                    if 4.80000000000000048e130 < 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. Add Preprocessing
                    3. Taylor expanded in t around 0

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

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

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

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

                      \[\leadsto \mathsf{fma}\left(i, y, \mathsf{fma}\left(\log y, x, z + \frac{-1}{2} \cdot \log c\right)\right) + a \]
                    7. Step-by-step derivation
                      1. Applied rewrites88.7%

                        \[\leadsto \mathsf{fma}\left(i, y, \mathsf{fma}\left(\log y, x, \mathsf{fma}\left(-0.5, \log c, z\right)\right)\right) + a \]
                    8. Recombined 3 regimes into one program.
                    9. Add Preprocessing

                    Alternative 7: 84.4% accurate, 1.0× speedup?

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

                      \[\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
                    3. Taylor expanded in t around 0

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

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

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

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

                    Alternative 8: 91.9% accurate, 1.7× speedup?

                    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.15 \cdot 10^{+63} \lor \neg \left(x \leq 4.8 \cdot 10^{+130}\right):\\ \;\;\;\;\mathsf{fma}\left(i, y, \mathsf{fma}\left(\log y, x, 1 \cdot z\right)\right) + a\\ \mathbf{else}:\\ \;\;\;\;\left(a + t\right) + \mathsf{fma}\left(b - 0.5, \log c, \mathsf{fma}\left(i, y, z\right)\right)\\ \end{array} \end{array} \]
                    (FPCore (x y z t a b c i)
                     :precision binary64
                     (if (or (<= x -1.15e+63) (not (<= x 4.8e+130)))
                       (+ (fma i y (fma (log y) x (* 1.0 z))) a)
                       (+ (+ a t) (fma (- b 0.5) (log c) (fma i y z)))))
                    double code(double x, double y, double z, double t, double a, double b, double c, double i) {
                    	double tmp;
                    	if ((x <= -1.15e+63) || !(x <= 4.8e+130)) {
                    		tmp = fma(i, y, fma(log(y), x, (1.0 * z))) + a;
                    	} else {
                    		tmp = (a + t) + fma((b - 0.5), log(c), fma(i, y, z));
                    	}
                    	return tmp;
                    }
                    
                    function code(x, y, z, t, a, b, c, i)
                    	tmp = 0.0
                    	if ((x <= -1.15e+63) || !(x <= 4.8e+130))
                    		tmp = Float64(fma(i, y, fma(log(y), x, Float64(1.0 * z))) + a);
                    	else
                    		tmp = Float64(Float64(a + t) + fma(Float64(b - 0.5), log(c), fma(i, y, z)));
                    	end
                    	return tmp
                    end
                    
                    code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[x, -1.15e+63], N[Not[LessEqual[x, 4.8e+130]], $MachinePrecision]], N[(N[(i * y + N[(N[Log[y], $MachinePrecision] * x + N[(1.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + a), $MachinePrecision], N[(N[(a + t), $MachinePrecision] + N[(N[(b - 0.5), $MachinePrecision] * N[Log[c], $MachinePrecision] + N[(i * y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
                    
                    \begin{array}{l}
                    
                    \\
                    \begin{array}{l}
                    \mathbf{if}\;x \leq -1.15 \cdot 10^{+63} \lor \neg \left(x \leq 4.8 \cdot 10^{+130}\right):\\
                    \;\;\;\;\mathsf{fma}\left(i, y, \mathsf{fma}\left(\log y, x, 1 \cdot z\right)\right) + a\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;\left(a + t\right) + \mathsf{fma}\left(b - 0.5, \log c, \mathsf{fma}\left(i, y, z\right)\right)\\
                    
                    
                    \end{array}
                    \end{array}
                    
                    Derivation
                    1. Split input into 2 regimes
                    2. if x < -1.14999999999999997e63 or 4.80000000000000048e130 < 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. Add Preprocessing
                      3. Taylor expanded in t around 0

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

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

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

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

                        \[\leadsto \mathsf{fma}\left(i, y, \mathsf{fma}\left(\log y, x, z \cdot \left(1 + \frac{\log c \cdot \left(b - \frac{1}{2}\right)}{z}\right)\right)\right) + a \]
                      7. Step-by-step derivation
                        1. Applied rewrites87.7%

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

                          \[\leadsto \mathsf{fma}\left(i, y, \mathsf{fma}\left(\log y, x, 1 \cdot z\right)\right) + a \]
                        3. Step-by-step derivation
                          1. Applied rewrites86.5%

                            \[\leadsto \mathsf{fma}\left(i, y, \mathsf{fma}\left(\log y, x, 1 \cdot z\right)\right) + a \]

                          if -1.14999999999999997e63 < x < 4.80000000000000048e130

                          1. Initial program 99.9%

                            \[\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
                          3. 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)} \]
                          4. Step-by-step derivation
                            1. associate-+r+N/A

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

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

                              \[\leadsto \color{blue}{\left(a + t\right)} + \left(z + \left(i \cdot y + \log c \cdot \left(b - \frac{1}{2}\right)\right)\right) \]
                            4. associate-+r+N/A

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

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

                              \[\leadsto \left(a + t\right) + \left(\color{blue}{\left(b - \frac{1}{2}\right) \cdot \log c} + \left(z + i \cdot y\right)\right) \]
                            7. lower-fma.f64N/A

                              \[\leadsto \left(a + t\right) + \color{blue}{\mathsf{fma}\left(b - \frac{1}{2}, \log c, z + i \cdot y\right)} \]
                            8. lower--.f64N/A

                              \[\leadsto \left(a + t\right) + \mathsf{fma}\left(\color{blue}{b - \frac{1}{2}}, \log c, z + i \cdot y\right) \]
                            9. lower-log.f64N/A

                              \[\leadsto \left(a + t\right) + \mathsf{fma}\left(b - \frac{1}{2}, \color{blue}{\log c}, z + i \cdot y\right) \]
                            10. +-commutativeN/A

                              \[\leadsto \left(a + t\right) + \mathsf{fma}\left(b - \frac{1}{2}, \log c, \color{blue}{i \cdot y + z}\right) \]
                            11. lower-fma.f6497.3

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

                            \[\leadsto \color{blue}{\left(a + t\right) + \mathsf{fma}\left(b - 0.5, \log c, \mathsf{fma}\left(i, y, z\right)\right)} \]
                        4. Recombined 2 regimes into one program.
                        5. Final simplification93.6%

                          \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.15 \cdot 10^{+63} \lor \neg \left(x \leq 4.8 \cdot 10^{+130}\right):\\ \;\;\;\;\mathsf{fma}\left(i, y, \mathsf{fma}\left(\log y, x, 1 \cdot z\right)\right) + a\\ \mathbf{else}:\\ \;\;\;\;\left(a + t\right) + \mathsf{fma}\left(b - 0.5, \log c, \mathsf{fma}\left(i, y, z\right)\right)\\ \end{array} \]
                        6. Add Preprocessing

                        Alternative 9: 79.8% accurate, 1.8× speedup?

                        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.15 \cdot 10^{+63} \lor \neg \left(x \leq 4.8 \cdot 10^{+130}\right):\\ \;\;\;\;\mathsf{fma}\left(i, y, \mathsf{fma}\left(\log y, x, 1 \cdot z\right)\right) + a\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(i, y, \mathsf{fma}\left(\log c, b - 0.5, z\right)\right) + a\\ \end{array} \end{array} \]
                        (FPCore (x y z t a b c i)
                         :precision binary64
                         (if (or (<= x -1.15e+63) (not (<= x 4.8e+130)))
                           (+ (fma i y (fma (log y) x (* 1.0 z))) a)
                           (+ (fma i y (fma (log c) (- b 0.5) z)) a)))
                        double code(double x, double y, double z, double t, double a, double b, double c, double i) {
                        	double tmp;
                        	if ((x <= -1.15e+63) || !(x <= 4.8e+130)) {
                        		tmp = fma(i, y, fma(log(y), x, (1.0 * z))) + a;
                        	} else {
                        		tmp = fma(i, y, fma(log(c), (b - 0.5), z)) + a;
                        	}
                        	return tmp;
                        }
                        
                        function code(x, y, z, t, a, b, c, i)
                        	tmp = 0.0
                        	if ((x <= -1.15e+63) || !(x <= 4.8e+130))
                        		tmp = Float64(fma(i, y, fma(log(y), x, Float64(1.0 * z))) + a);
                        	else
                        		tmp = Float64(fma(i, y, fma(log(c), Float64(b - 0.5), z)) + a);
                        	end
                        	return tmp
                        end
                        
                        code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[x, -1.15e+63], N[Not[LessEqual[x, 4.8e+130]], $MachinePrecision]], N[(N[(i * y + N[(N[Log[y], $MachinePrecision] * x + N[(1.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + a), $MachinePrecision], N[(N[(i * y + N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision] + z), $MachinePrecision]), $MachinePrecision] + a), $MachinePrecision]]
                        
                        \begin{array}{l}
                        
                        \\
                        \begin{array}{l}
                        \mathbf{if}\;x \leq -1.15 \cdot 10^{+63} \lor \neg \left(x \leq 4.8 \cdot 10^{+130}\right):\\
                        \;\;\;\;\mathsf{fma}\left(i, y, \mathsf{fma}\left(\log y, x, 1 \cdot z\right)\right) + a\\
                        
                        \mathbf{else}:\\
                        \;\;\;\;\mathsf{fma}\left(i, y, \mathsf{fma}\left(\log c, b - 0.5, z\right)\right) + a\\
                        
                        
                        \end{array}
                        \end{array}
                        
                        Derivation
                        1. Split input into 2 regimes
                        2. if x < -1.14999999999999997e63 or 4.80000000000000048e130 < 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. Add Preprocessing
                          3. Taylor expanded in t around 0

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

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

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

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

                            \[\leadsto \mathsf{fma}\left(i, y, \mathsf{fma}\left(\log y, x, z \cdot \left(1 + \frac{\log c \cdot \left(b - \frac{1}{2}\right)}{z}\right)\right)\right) + a \]
                          7. Step-by-step derivation
                            1. Applied rewrites87.7%

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

                              \[\leadsto \mathsf{fma}\left(i, y, \mathsf{fma}\left(\log y, x, 1 \cdot z\right)\right) + a \]
                            3. Step-by-step derivation
                              1. Applied rewrites86.5%

                                \[\leadsto \mathsf{fma}\left(i, y, \mathsf{fma}\left(\log y, x, 1 \cdot z\right)\right) + a \]

                              if -1.14999999999999997e63 < x < 4.80000000000000048e130

                              1. Initial program 99.9%

                                \[\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
                              3. Taylor expanded in t around 0

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

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

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

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

                                \[\leadsto \mathsf{fma}\left(i, y, z + \log c \cdot \left(b - \frac{1}{2}\right)\right) + a \]
                              7. Step-by-step derivation
                                1. Applied rewrites76.8%

                                  \[\leadsto \mathsf{fma}\left(i, y, \mathsf{fma}\left(\log c, b - 0.5, z\right)\right) + a \]
                              8. Recombined 2 regimes into one program.
                              9. Final simplification80.2%

                                \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.15 \cdot 10^{+63} \lor \neg \left(x \leq 4.8 \cdot 10^{+130}\right):\\ \;\;\;\;\mathsf{fma}\left(i, y, \mathsf{fma}\left(\log y, x, 1 \cdot z\right)\right) + a\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(i, y, \mathsf{fma}\left(\log c, b - 0.5, z\right)\right) + a\\ \end{array} \]
                              10. Add Preprocessing

                              Alternative 10: 70.5% accurate, 1.8× speedup?

                              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;i \leq -4 \cdot 10^{+106} \lor \neg \left(i \leq 1300\right):\\ \;\;\;\;\left(\frac{z}{i} + y\right) \cdot i + a\\ \mathbf{else}:\\ \;\;\;\;\left(\mathsf{fma}\left(\log c, b - 0.5, z\right) + t\right) + a\\ \end{array} \end{array} \]
                              (FPCore (x y z t a b c i)
                               :precision binary64
                               (if (or (<= i -4e+106) (not (<= i 1300.0)))
                                 (+ (* (+ (/ z i) y) i) a)
                                 (+ (+ (fma (log c) (- b 0.5) z) t) a)))
                              double code(double x, double y, double z, double t, double a, double b, double c, double i) {
                              	double tmp;
                              	if ((i <= -4e+106) || !(i <= 1300.0)) {
                              		tmp = (((z / i) + y) * i) + a;
                              	} else {
                              		tmp = (fma(log(c), (b - 0.5), z) + t) + a;
                              	}
                              	return tmp;
                              }
                              
                              function code(x, y, z, t, a, b, c, i)
                              	tmp = 0.0
                              	if ((i <= -4e+106) || !(i <= 1300.0))
                              		tmp = Float64(Float64(Float64(Float64(z / i) + y) * i) + a);
                              	else
                              		tmp = Float64(Float64(fma(log(c), Float64(b - 0.5), z) + t) + a);
                              	end
                              	return tmp
                              end
                              
                              code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[i, -4e+106], N[Not[LessEqual[i, 1300.0]], $MachinePrecision]], N[(N[(N[(N[(z / i), $MachinePrecision] + y), $MachinePrecision] * i), $MachinePrecision] + a), $MachinePrecision], N[(N[(N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision] + z), $MachinePrecision] + t), $MachinePrecision] + a), $MachinePrecision]]
                              
                              \begin{array}{l}
                              
                              \\
                              \begin{array}{l}
                              \mathbf{if}\;i \leq -4 \cdot 10^{+106} \lor \neg \left(i \leq 1300\right):\\
                              \;\;\;\;\left(\frac{z}{i} + y\right) \cdot i + a\\
                              
                              \mathbf{else}:\\
                              \;\;\;\;\left(\mathsf{fma}\left(\log c, b - 0.5, z\right) + t\right) + a\\
                              
                              
                              \end{array}
                              \end{array}
                              
                              Derivation
                              1. Split input into 2 regimes
                              2. if i < -4.00000000000000036e106 or 1300 < i

                                1. Initial program 99.9%

                                  \[\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
                                3. Taylor expanded in t around 0

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

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

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

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

                                  \[\leadsto \mathsf{fma}\left(i, y, \mathsf{fma}\left(\log y, x, z \cdot \left(1 + \frac{\log c \cdot \left(b - \frac{1}{2}\right)}{z}\right)\right)\right) + a \]
                                7. Step-by-step derivation
                                  1. Applied rewrites81.2%

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

                                    \[\leadsto i \cdot \left(y + \left(\frac{z}{i} + \left(\frac{x \cdot \log y}{i} + \frac{\log c \cdot \left(b - \frac{1}{2}\right)}{i}\right)\right)\right) + a \]
                                  3. Step-by-step derivation
                                    1. Applied rewrites89.6%

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

                                      \[\leadsto \left(\frac{z}{i} + y\right) \cdot i + a \]
                                    3. Step-by-step derivation
                                      1. Applied rewrites67.1%

                                        \[\leadsto \left(\frac{z}{i} + y\right) \cdot i + a \]

                                      if -4.00000000000000036e106 < i < 1300

                                      1. Initial program 99.9%

                                        \[\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
                                      3. 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)} \]
                                      4. Step-by-step derivation
                                        1. associate-+r+N/A

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

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

                                          \[\leadsto \color{blue}{\left(a + t\right)} + \left(z + \left(i \cdot y + \log c \cdot \left(b - \frac{1}{2}\right)\right)\right) \]
                                        4. associate-+r+N/A

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

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

                                          \[\leadsto \left(a + t\right) + \left(\color{blue}{\left(b - \frac{1}{2}\right) \cdot \log c} + \left(z + i \cdot y\right)\right) \]
                                        7. lower-fma.f64N/A

                                          \[\leadsto \left(a + t\right) + \color{blue}{\mathsf{fma}\left(b - \frac{1}{2}, \log c, z + i \cdot y\right)} \]
                                        8. lower--.f64N/A

                                          \[\leadsto \left(a + t\right) + \mathsf{fma}\left(\color{blue}{b - \frac{1}{2}}, \log c, z + i \cdot y\right) \]
                                        9. lower-log.f64N/A

                                          \[\leadsto \left(a + t\right) + \mathsf{fma}\left(b - \frac{1}{2}, \color{blue}{\log c}, z + i \cdot y\right) \]
                                        10. +-commutativeN/A

                                          \[\leadsto \left(a + t\right) + \mathsf{fma}\left(b - \frac{1}{2}, \log c, \color{blue}{i \cdot y + z}\right) \]
                                        11. lower-fma.f6483.2

                                          \[\leadsto \left(a + t\right) + \mathsf{fma}\left(b - 0.5, \log c, \color{blue}{\mathsf{fma}\left(i, y, z\right)}\right) \]
                                      5. Applied rewrites83.2%

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

                                        \[\leadsto a + \color{blue}{\left(t + \left(z + \log c \cdot \left(b - \frac{1}{2}\right)\right)\right)} \]
                                      7. Step-by-step derivation
                                        1. Applied rewrites79.6%

                                          \[\leadsto \left(\mathsf{fma}\left(\log c, b - 0.5, z\right) + t\right) + \color{blue}{a} \]
                                      8. Recombined 2 regimes into one program.
                                      9. Final simplification74.3%

                                        \[\leadsto \begin{array}{l} \mathbf{if}\;i \leq -4 \cdot 10^{+106} \lor \neg \left(i \leq 1300\right):\\ \;\;\;\;\left(\frac{z}{i} + y\right) \cdot i + a\\ \mathbf{else}:\\ \;\;\;\;\left(\mathsf{fma}\left(\log c, b - 0.5, z\right) + t\right) + a\\ \end{array} \]
                                      10. Add Preprocessing

                                      Alternative 11: 71.2% accurate, 1.9× speedup?

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

                                        1. Initial program 99.9%

                                          \[\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
                                        3. Taylor expanded in t around 0

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

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

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

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

                                          \[\leadsto \mathsf{fma}\left(i, y, z + \log c \cdot \left(b - \frac{1}{2}\right)\right) + a \]
                                        7. Step-by-step derivation
                                          1. Applied rewrites70.5%

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

                                          if 1.3500000000000001e226 < x

                                          1. Initial program 99.5%

                                            \[\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
                                          3. Taylor expanded in t around 0

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

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

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

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

                                            \[\leadsto \color{blue}{x \cdot \log y} \]
                                          7. Step-by-step derivation
                                            1. *-commutativeN/A

                                              \[\leadsto \color{blue}{\log y \cdot x} \]
                                            2. lower-*.f64N/A

                                              \[\leadsto \color{blue}{\log y \cdot x} \]
                                            3. lower-log.f6477.5

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

                                            \[\leadsto \color{blue}{\log y \cdot x} \]
                                        8. Recombined 2 regimes into one program.
                                        9. Add Preprocessing

                                        Alternative 12: 48.7% accurate, 6.7× speedup?

                                        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;i \leq -1.55 \cdot 10^{-79} \lor \neg \left(i \leq 3.5 \cdot 10^{-88}\right):\\ \;\;\;\;\left(\frac{z}{i} + y\right) \cdot i + a\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{z}{a}, a, a\right)\\ \end{array} \end{array} \]
                                        (FPCore (x y z t a b c i)
                                         :precision binary64
                                         (if (or (<= i -1.55e-79) (not (<= i 3.5e-88)))
                                           (+ (* (+ (/ z i) y) i) a)
                                           (fma (/ z a) a a)))
                                        double code(double x, double y, double z, double t, double a, double b, double c, double i) {
                                        	double tmp;
                                        	if ((i <= -1.55e-79) || !(i <= 3.5e-88)) {
                                        		tmp = (((z / i) + y) * i) + a;
                                        	} else {
                                        		tmp = fma((z / a), a, a);
                                        	}
                                        	return tmp;
                                        }
                                        
                                        function code(x, y, z, t, a, b, c, i)
                                        	tmp = 0.0
                                        	if ((i <= -1.55e-79) || !(i <= 3.5e-88))
                                        		tmp = Float64(Float64(Float64(Float64(z / i) + y) * i) + a);
                                        	else
                                        		tmp = fma(Float64(z / a), a, a);
                                        	end
                                        	return tmp
                                        end
                                        
                                        code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[i, -1.55e-79], N[Not[LessEqual[i, 3.5e-88]], $MachinePrecision]], N[(N[(N[(N[(z / i), $MachinePrecision] + y), $MachinePrecision] * i), $MachinePrecision] + a), $MachinePrecision], N[(N[(z / a), $MachinePrecision] * a + a), $MachinePrecision]]
                                        
                                        \begin{array}{l}
                                        
                                        \\
                                        \begin{array}{l}
                                        \mathbf{if}\;i \leq -1.55 \cdot 10^{-79} \lor \neg \left(i \leq 3.5 \cdot 10^{-88}\right):\\
                                        \;\;\;\;\left(\frac{z}{i} + y\right) \cdot i + a\\
                                        
                                        \mathbf{else}:\\
                                        \;\;\;\;\mathsf{fma}\left(\frac{z}{a}, a, a\right)\\
                                        
                                        
                                        \end{array}
                                        \end{array}
                                        
                                        Derivation
                                        1. Split input into 2 regimes
                                        2. if i < -1.55e-79 or 3.5000000000000001e-88 < i

                                          1. Initial program 99.9%

                                            \[\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
                                          3. Taylor expanded in t around 0

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

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

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

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

                                            \[\leadsto \mathsf{fma}\left(i, y, \mathsf{fma}\left(\log y, x, z \cdot \left(1 + \frac{\log c \cdot \left(b - \frac{1}{2}\right)}{z}\right)\right)\right) + a \]
                                          7. Step-by-step derivation
                                            1. Applied rewrites80.0%

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

                                              \[\leadsto i \cdot \left(y + \left(\frac{z}{i} + \left(\frac{x \cdot \log y}{i} + \frac{\log c \cdot \left(b - \frac{1}{2}\right)}{i}\right)\right)\right) + a \]
                                            3. Step-by-step derivation
                                              1. Applied rewrites87.4%

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

                                                \[\leadsto \left(\frac{z}{i} + y\right) \cdot i + a \]
                                              3. Step-by-step derivation
                                                1. Applied rewrites60.6%

                                                  \[\leadsto \left(\frac{z}{i} + y\right) \cdot i + a \]

                                                if -1.55e-79 < i < 3.5000000000000001e-88

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

                                                  \[\leadsto \color{blue}{a \cdot \left(1 + \left(\frac{t}{a} + \left(\frac{z}{a} + \left(\frac{i \cdot y}{a} + \left(\frac{x \cdot \log y}{a} + \frac{\log c \cdot \left(b - \frac{1}{2}\right)}{a}\right)\right)\right)\right)\right)} \]
                                                4. Step-by-step derivation
                                                  1. distribute-rgt-inN/A

                                                    \[\leadsto \color{blue}{1 \cdot a + \left(\frac{t}{a} + \left(\frac{z}{a} + \left(\frac{i \cdot y}{a} + \left(\frac{x \cdot \log y}{a} + \frac{\log c \cdot \left(b - \frac{1}{2}\right)}{a}\right)\right)\right)\right) \cdot a} \]
                                                  2. *-lft-identityN/A

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

                                                    \[\leadsto \color{blue}{\left(\frac{t}{a} + \left(\frac{z}{a} + \left(\frac{i \cdot y}{a} + \left(\frac{x \cdot \log y}{a} + \frac{\log c \cdot \left(b - \frac{1}{2}\right)}{a}\right)\right)\right)\right) \cdot a + a} \]
                                                  4. lower-fma.f64N/A

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

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

                                                  \[\leadsto \mathsf{fma}\left(\frac{z}{a}, a, a\right) \]
                                                7. Step-by-step derivation
                                                  1. Applied rewrites32.6%

                                                    \[\leadsto \mathsf{fma}\left(\frac{z}{a}, a, a\right) \]
                                                8. Recombined 2 regimes into one program.
                                                9. Final simplification50.2%

                                                  \[\leadsto \begin{array}{l} \mathbf{if}\;i \leq -1.55 \cdot 10^{-79} \lor \neg \left(i \leq 3.5 \cdot 10^{-88}\right):\\ \;\;\;\;\left(\frac{z}{i} + y\right) \cdot i + a\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{z}{a}, a, a\right)\\ \end{array} \]
                                                10. Add Preprocessing

                                                Alternative 13: 24.2% accurate, 39.0× speedup?

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

                                                  \[\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
                                                3. Taylor expanded in y around inf

                                                  \[\leadsto \color{blue}{i \cdot y} \]
                                                4. Step-by-step derivation
                                                  1. lower-*.f6426.3

                                                    \[\leadsto \color{blue}{i \cdot y} \]
                                                5. Applied rewrites26.3%

                                                  \[\leadsto \color{blue}{i \cdot y} \]
                                                6. Add Preprocessing

                                                Reproduce

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