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

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

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

Initial Program: 99.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(\left(\left(\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: 44.2% 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 -1.5 \cdot 10^{+308}:\\ \;\;\;\;i \cdot y\\ \mathbf{elif}\;t\_1 \leq 100:\\ \;\;\;\;\mathsf{fma}\left(\log c, -0.5, z\right) + a\\ \mathbf{elif}\;t\_1 \leq 1.5 \cdot 10^{+305}:\\ \;\;\;\;\mathsf{fma}\left(\log c, b - 0.5, 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 -1.5e+308)
     (* i y)
     (if (<= t_1 100.0)
       (+ (fma (log c) -0.5 z) a)
       (if (<= t_1 1.5e+305) (fma (log c) (- b 0.5) 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 <= -1.5e+308) {
		tmp = i * y;
	} else if (t_1 <= 100.0) {
		tmp = fma(log(c), -0.5, z) + a;
	} else if (t_1 <= 1.5e+305) {
		tmp = fma(log(c), (b - 0.5), 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 <= -1.5e+308)
		tmp = Float64(i * y);
	elseif (t_1 <= 100.0)
		tmp = Float64(fma(log(c), -0.5, z) + a);
	elseif (t_1 <= 1.5e+305)
		tmp = fma(log(c), Float64(b - 0.5), 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, -1.5e+308], N[(i * y), $MachinePrecision], If[LessEqual[t$95$1, 100.0], N[(N[(N[Log[c], $MachinePrecision] * -0.5 + z), $MachinePrecision] + a), $MachinePrecision], If[LessEqual[t$95$1, 1.5e+305], N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision] + 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 -1.5 \cdot 10^{+308}:\\
\;\;\;\;i \cdot y\\

\mathbf{elif}\;t\_1 \leq 100:\\
\;\;\;\;\mathsf{fma}\left(\log c, -0.5, z\right) + a\\

\mathbf{elif}\;t\_1 \leq 1.5 \cdot 10^{+305}:\\
\;\;\;\;\mathsf{fma}\left(\log c, b - 0.5, 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)) < -1.5e308 or 1.49999999999999991e305 < (+.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 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. Applied rewrites100.0%

      \[\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} \]
    5. 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 \]
    6. Step-by-step derivation
      1. Applied rewrites95.3%

        \[\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 y around inf

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

          \[\leadsto \color{blue}{i \cdot y} \]
      4. Applied rewrites90.5%

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

      if -1.5e308 < (+.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)) < 100

      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. Applied rewrites89.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} \]
      5. Taylor expanded in y around 0

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

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

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

            \[\leadsto \mathsf{fma}\left(\log c, b - 0.5, z\right) + a \]
          2. Taylor expanded in b around 0

            \[\leadsto \mathsf{fma}\left(\log c, \frac{-1}{2}, z\right) + a \]
          3. Step-by-step derivation
            1. Applied rewrites44.5%

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

            if 100 < (+.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.49999999999999991e305

            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. Applied rewrites80.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} \]
            5. Taylor expanded in y around 0

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

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

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

                  \[\leadsto \mathsf{fma}\left(\log c, b - 0.5, z\right) + a \]
                2. Taylor expanded in z around 0

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

                    \[\leadsto \mathsf{fma}\left(\log c, b - 0.5, a\right) \]
                4. Recombined 3 regimes into one program.
                5. 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 -1.5 \cdot 10^{+308}:\\ \;\;\;\;i \cdot y\\ \mathbf{elif}\;t\_1 \leq -50:\\ \;\;\;\;\frac{z}{y} \cdot y\\ \mathbf{elif}\;t\_1 \leq 1.5 \cdot 10^{+305}:\\ \;\;\;\;\frac{a}{y} \cdot y\\ \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 -1.5e+308)
                     (* i y)
                     (if (<= t_1 -50.0)
                       (* (/ z y) y)
                       (if (<= t_1 1.5e+305) (* (/ a y) y) (* 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 <= -1.5e+308) {
                		tmp = i * y;
                	} else if (t_1 <= -50.0) {
                		tmp = (z / y) * y;
                	} else if (t_1 <= 1.5e+305) {
                		tmp = (a / y) * y;
                	} else {
                		tmp = i * y;
                	}
                	return tmp;
                }
                
                module fmin_fmax_functions
                    implicit none
                    private
                    public fmax
                    public fmin
                
                    interface fmax
                        module procedure fmax88
                        module procedure fmax44
                        module procedure fmax84
                        module procedure fmax48
                    end interface
                    interface fmin
                        module procedure fmin88
                        module procedure fmin44
                        module procedure fmin84
                        module procedure fmin48
                    end interface
                contains
                    real(8) function fmax88(x, y) result (res)
                        real(8), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                    end function
                    real(4) function fmax44(x, y) result (res)
                        real(4), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                    end function
                    real(8) function fmax84(x, y) result(res)
                        real(8), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                    end function
                    real(8) function fmax48(x, y) result(res)
                        real(4), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                    end function
                    real(8) function fmin88(x, y) result (res)
                        real(8), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                    end function
                    real(4) function fmin44(x, y) result (res)
                        real(4), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                    end function
                    real(8) function fmin84(x, y) result(res)
                        real(8), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                    end function
                    real(8) function fmin48(x, y) result(res)
                        real(4), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                    end function
                end module
                
                real(8) function code(x, y, z, t, a, b, c, i)
                use fmin_fmax_functions
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    real(8), intent (in) :: z
                    real(8), intent (in) :: t
                    real(8), intent (in) :: a
                    real(8), intent (in) :: b
                    real(8), intent (in) :: c
                    real(8), intent (in) :: i
                    real(8) :: t_1
                    real(8) :: tmp
                    t_1 = (((((x * log(y)) + z) + t) + a) + ((b - 0.5d0) * log(c))) + (y * i)
                    if (t_1 <= (-1.5d+308)) then
                        tmp = i * y
                    else if (t_1 <= (-50.0d0)) then
                        tmp = (z / y) * y
                    else if (t_1 <= 1.5d+305) then
                        tmp = (a / y) * y
                    else
                        tmp = i * y
                    end if
                    code = tmp
                end function
                
                public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
                	double t_1 = (((((x * Math.log(y)) + z) + t) + a) + ((b - 0.5) * Math.log(c))) + (y * i);
                	double tmp;
                	if (t_1 <= -1.5e+308) {
                		tmp = i * y;
                	} else if (t_1 <= -50.0) {
                		tmp = (z / y) * y;
                	} else if (t_1 <= 1.5e+305) {
                		tmp = (a / y) * y;
                	} 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 <= -1.5e+308:
                		tmp = i * y
                	elif t_1 <= -50.0:
                		tmp = (z / y) * y
                	elif t_1 <= 1.5e+305:
                		tmp = (a / y) * y
                	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 <= -1.5e+308)
                		tmp = Float64(i * y);
                	elseif (t_1 <= -50.0)
                		tmp = Float64(Float64(z / y) * y);
                	elseif (t_1 <= 1.5e+305)
                		tmp = Float64(Float64(a / y) * y);
                	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 <= -1.5e+308)
                		tmp = i * y;
                	elseif (t_1 <= -50.0)
                		tmp = (z / y) * y;
                	elseif (t_1 <= 1.5e+305)
                		tmp = (a / y) * y;
                	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, -1.5e+308], N[(i * y), $MachinePrecision], If[LessEqual[t$95$1, -50.0], N[(N[(z / y), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[t$95$1, 1.5e+305], N[(N[(a / y), $MachinePrecision] * y), $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 -1.5 \cdot 10^{+308}:\\
                \;\;\;\;i \cdot y\\
                
                \mathbf{elif}\;t\_1 \leq -50:\\
                \;\;\;\;\frac{z}{y} \cdot y\\
                
                \mathbf{elif}\;t\_1 \leq 1.5 \cdot 10^{+305}:\\
                \;\;\;\;\frac{a}{y} \cdot y\\
                
                \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)) < -1.5e308 or 1.49999999999999991e305 < (+.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 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. Applied rewrites100.0%

                    \[\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} \]
                  5. 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 \]
                  6. Step-by-step derivation
                    1. Applied rewrites95.3%

                      \[\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 y around inf

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

                        \[\leadsto \color{blue}{i \cdot y} \]
                    4. Applied rewrites90.5%

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

                    if -1.5e308 < (+.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)) < -50

                    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 y around inf

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

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

                      \[\leadsto \frac{z}{y} \cdot y \]
                    6. Step-by-step derivation
                      1. Applied rewrites18.1%

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

                      if -50 < (+.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.49999999999999991e305

                      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}{y \cdot \left(i + \left(-1 \cdot \frac{x \cdot \log \left(\frac{1}{y}\right)}{y} + \left(\frac{a}{y} + \left(\frac{t}{y} + \left(\frac{z}{y} + \frac{\log c \cdot \left(b - \frac{1}{2}\right)}{y}\right)\right)\right)\right)\right)} \]
                      4. Applied rewrites57.8%

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

                        \[\leadsto \frac{a}{y} \cdot y \]
                      6. Step-by-step derivation
                        1. Applied rewrites15.2%

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

                      Alternative 4: 64.0% accurate, 0.4× 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 500:\\ \;\;\;\;\mathsf{fma}\left(i, y, z\right) + \mathsf{fma}\left(\log c, b - 0.5, t\right)\\ \mathbf{elif}\;t\_1 \leq 1.5 \cdot 10^{+305}:\\ \;\;\;\;\mathsf{fma}\left(\log c, b - 0.5, z\right) + a\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(i, y, z\right) + \mathsf{fma}\left(\log c, -0.5, t\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 (<= t_1 500.0)
                           (+ (fma i y z) (fma (log c) (- b 0.5) t))
                           (if (<= t_1 1.5e+305)
                             (+ (fma (log c) (- b 0.5) z) a)
                             (+ (fma i y z) (fma (log c) -0.5 t))))))
                      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 <= 500.0) {
                      		tmp = fma(i, y, z) + fma(log(c), (b - 0.5), t);
                      	} else if (t_1 <= 1.5e+305) {
                      		tmp = fma(log(c), (b - 0.5), z) + a;
                      	} else {
                      		tmp = fma(i, y, z) + fma(log(c), -0.5, t);
                      	}
                      	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 <= 500.0)
                      		tmp = Float64(fma(i, y, z) + fma(log(c), Float64(b - 0.5), t));
                      	elseif (t_1 <= 1.5e+305)
                      		tmp = Float64(fma(log(c), Float64(b - 0.5), z) + a);
                      	else
                      		tmp = Float64(fma(i, y, z) + fma(log(c), -0.5, t));
                      	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, 500.0], N[(N[(i * y + z), $MachinePrecision] + N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1.5e+305], N[(N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision] + z), $MachinePrecision] + a), $MachinePrecision], N[(N[(i * y + z), $MachinePrecision] + N[(N[Log[c], $MachinePrecision] * -0.5 + t), $MachinePrecision]), $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 500:\\
                      \;\;\;\;\mathsf{fma}\left(i, y, z\right) + \mathsf{fma}\left(\log c, b - 0.5, t\right)\\
                      
                      \mathbf{elif}\;t\_1 \leq 1.5 \cdot 10^{+305}:\\
                      \;\;\;\;\mathsf{fma}\left(\log c, b - 0.5, z\right) + a\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;\mathsf{fma}\left(i, y, z\right) + \mathsf{fma}\left(\log c, -0.5, t\right)\\
                      
                      
                      \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)) < 500

                        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 0

                          \[\leadsto \color{blue}{t + \left(z + \left(i \cdot y + \left(x \cdot \log y + \log c \cdot \left(b - \frac{1}{2}\right)\right)\right)\right)} \]
                        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) + t} \]
                          2. associate-+r+N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                          if 500 < (+.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.49999999999999991e305

                          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. Applied rewrites79.8%

                            \[\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} \]
                          5. Taylor expanded in y around 0

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

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

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

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

                              if 1.49999999999999991e305 < (+.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 a around 0

                                \[\leadsto \color{blue}{t + \left(z + \left(i \cdot y + \left(x \cdot \log y + \log c \cdot \left(b - \frac{1}{2}\right)\right)\right)\right)} \]
                              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) + t} \]
                                2. associate-+r+N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                  \[\leadsto \mathsf{fma}\left(i, y, z\right) + \mathsf{fma}\left(\log c, \frac{-1}{2}, t\right) \]
                                3. Step-by-step derivation
                                  1. Applied rewrites97.0%

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

                                Alternative 5: 58.2% accurate, 0.4× 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 1.5 \cdot 10^{+305}\right):\\ \;\;\;\;i \cdot y\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\log c, b - 0.5, z\right) + a\\ \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 1.5e+305)))
                                     (* 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 t_1 = (((((x * log(y)) + z) + t) + a) + ((b - 0.5) * log(c))) + (y * i);
                                	double tmp;
                                	if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 1.5e+305)) {
                                		tmp = i * y;
                                	} else {
                                		tmp = fma(log(c), (b - 0.5), z) + 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 <= 1.5e+305))
                                		tmp = Float64(i * y);
                                	else
                                		tmp = Float64(fma(log(c), Float64(b - 0.5), z) + 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, 1.5e+305]], $MachinePrecision]], N[(i * y), $MachinePrecision], N[(N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision] + z), $MachinePrecision] + 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 1.5 \cdot 10^{+305}\right):\\
                                \;\;\;\;i \cdot y\\
                                
                                \mathbf{else}:\\
                                \;\;\;\;\mathsf{fma}\left(\log c, b - 0.5, z\right) + a\\
                                
                                
                                \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 1.49999999999999991e305 < (+.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 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. Applied rewrites100.0%

                                    \[\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} \]
                                  5. 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 \]
                                  6. Step-by-step derivation
                                    1. Applied rewrites97.3%

                                      \[\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 y around inf

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

                                        \[\leadsto \color{blue}{i \cdot y} \]
                                    4. Applied rewrites92.9%

                                      \[\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.49999999999999991e305

                                    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. Applied rewrites85.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} \]
                                    5. Taylor expanded in y around 0

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

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

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

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

                                        \[\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 1.5 \cdot 10^{+305}\right):\\ \;\;\;\;i \cdot y\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\log c, b - 0.5, z\right) + a\\ \end{array} \]
                                      6. Add Preprocessing

                                      Alternative 6: 23.6% 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 -50 \lor \neg \left(t\_1 \leq 1.5 \cdot 10^{+305}\right):\\ \;\;\;\;i \cdot y\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{y} \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 (or (<= t_1 -50.0) (not (<= t_1 1.5e+305))) (* i y) (* (/ a y) 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 <= -50.0) || !(t_1 <= 1.5e+305)) {
                                      		tmp = i * y;
                                      	} else {
                                      		tmp = (a / y) * y;
                                      	}
                                      	return tmp;
                                      }
                                      
                                      module fmin_fmax_functions
                                          implicit none
                                          private
                                          public fmax
                                          public fmin
                                      
                                          interface fmax
                                              module procedure fmax88
                                              module procedure fmax44
                                              module procedure fmax84
                                              module procedure fmax48
                                          end interface
                                          interface fmin
                                              module procedure fmin88
                                              module procedure fmin44
                                              module procedure fmin84
                                              module procedure fmin48
                                          end interface
                                      contains
                                          real(8) function fmax88(x, y) result (res)
                                              real(8), intent (in) :: x
                                              real(8), intent (in) :: y
                                              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                          end function
                                          real(4) function fmax44(x, y) result (res)
                                              real(4), intent (in) :: x
                                              real(4), intent (in) :: y
                                              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                          end function
                                          real(8) function fmax84(x, y) result(res)
                                              real(8), intent (in) :: x
                                              real(4), intent (in) :: y
                                              res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                          end function
                                          real(8) function fmax48(x, y) result(res)
                                              real(4), intent (in) :: x
                                              real(8), intent (in) :: y
                                              res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                          end function
                                          real(8) function fmin88(x, y) result (res)
                                              real(8), intent (in) :: x
                                              real(8), intent (in) :: y
                                              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                          end function
                                          real(4) function fmin44(x, y) result (res)
                                              real(4), intent (in) :: x
                                              real(4), intent (in) :: y
                                              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                          end function
                                          real(8) function fmin84(x, y) result(res)
                                              real(8), intent (in) :: x
                                              real(4), intent (in) :: y
                                              res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                          end function
                                          real(8) function fmin48(x, y) result(res)
                                              real(4), intent (in) :: x
                                              real(8), intent (in) :: y
                                              res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                          end function
                                      end module
                                      
                                      real(8) function code(x, y, z, t, a, b, c, i)
                                      use fmin_fmax_functions
                                          real(8), intent (in) :: x
                                          real(8), intent (in) :: y
                                          real(8), intent (in) :: z
                                          real(8), intent (in) :: t
                                          real(8), intent (in) :: a
                                          real(8), intent (in) :: b
                                          real(8), intent (in) :: c
                                          real(8), intent (in) :: i
                                          real(8) :: t_1
                                          real(8) :: tmp
                                          t_1 = (((((x * log(y)) + z) + t) + a) + ((b - 0.5d0) * log(c))) + (y * i)
                                          if ((t_1 <= (-50.0d0)) .or. (.not. (t_1 <= 1.5d+305))) then
                                              tmp = i * y
                                          else
                                              tmp = (a / y) * y
                                          end if
                                          code = tmp
                                      end function
                                      
                                      public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
                                      	double t_1 = (((((x * Math.log(y)) + z) + t) + a) + ((b - 0.5) * Math.log(c))) + (y * i);
                                      	double tmp;
                                      	if ((t_1 <= -50.0) || !(t_1 <= 1.5e+305)) {
                                      		tmp = i * y;
                                      	} else {
                                      		tmp = (a / y) * 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 <= -50.0) or not (t_1 <= 1.5e+305):
                                      		tmp = i * y
                                      	else:
                                      		tmp = (a / y) * 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 <= -50.0) || !(t_1 <= 1.5e+305))
                                      		tmp = Float64(i * y);
                                      	else
                                      		tmp = Float64(Float64(a / y) * 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 <= -50.0) || ~((t_1 <= 1.5e+305)))
                                      		tmp = i * y;
                                      	else
                                      		tmp = (a / y) * 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[Or[LessEqual[t$95$1, -50.0], N[Not[LessEqual[t$95$1, 1.5e+305]], $MachinePrecision]], N[(i * y), $MachinePrecision], N[(N[(a / y), $MachinePrecision] * 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 -50 \lor \neg \left(t\_1 \leq 1.5 \cdot 10^{+305}\right):\\
                                      \;\;\;\;i \cdot y\\
                                      
                                      \mathbf{else}:\\
                                      \;\;\;\;\frac{a}{y} \cdot y\\
                                      
                                      
                                      \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)) < -50 or 1.49999999999999991e305 < (+.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 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. Applied rewrites92.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} \]
                                        5. 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 \]
                                        6. Step-by-step derivation
                                          1. Applied rewrites82.6%

                                            \[\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 y around inf

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

                                              \[\leadsto \color{blue}{i \cdot y} \]
                                          4. Applied rewrites34.1%

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

                                          if -50 < (+.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.49999999999999991e305

                                          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}{y \cdot \left(i + \left(-1 \cdot \frac{x \cdot \log \left(\frac{1}{y}\right)}{y} + \left(\frac{a}{y} + \left(\frac{t}{y} + \left(\frac{z}{y} + \frac{\log c \cdot \left(b - \frac{1}{2}\right)}{y}\right)\right)\right)\right)\right)} \]
                                          4. Applied rewrites57.8%

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

                                            \[\leadsto \frac{a}{y} \cdot y \]
                                          6. Step-by-step derivation
                                            1. Applied rewrites15.2%

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

                                            \[\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 -50 \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 1.5 \cdot 10^{+305}\right):\\ \;\;\;\;i \cdot y\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{y} \cdot y\\ \end{array} \]
                                          9. Add Preprocessing

                                          Alternative 7: 78.4% accurate, 1.0× speedup?

                                          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 8.2 \cdot 10^{-11}:\\ \;\;\;\;\mathsf{fma}\left(\log y, x, \mathsf{fma}\left(\log c, b - 0.5, z\right)\right) + a\\ \mathbf{elif}\;y \leq 2.15 \cdot 10^{+74}:\\ \;\;\;\;\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 (<= y 8.2e-11)
                                             (+ (fma (log y) x (fma (log c) (- b 0.5) z)) a)
                                             (if (<= y 2.15e+74)
                                               (+ (+ 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 (y <= 8.2e-11) {
                                          		tmp = fma(log(y), x, fma(log(c), (b - 0.5), z)) + a;
                                          	} else if (y <= 2.15e+74) {
                                          		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 (y <= 8.2e-11)
                                          		tmp = Float64(fma(log(y), x, fma(log(c), Float64(b - 0.5), z)) + a);
                                          	elseif (y <= 2.15e+74)
                                          		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[y, 8.2e-11], N[(N[(N[Log[y], $MachinePrecision] * x + N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision] + z), $MachinePrecision]), $MachinePrecision] + a), $MachinePrecision], If[LessEqual[y, 2.15e+74], 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}\;y \leq 8.2 \cdot 10^{-11}:\\
                                          \;\;\;\;\mathsf{fma}\left(\log y, x, \mathsf{fma}\left(\log c, b - 0.5, z\right)\right) + a\\
                                          
                                          \mathbf{elif}\;y \leq 2.15 \cdot 10^{+74}:\\
                                          \;\;\;\;\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 y < 8.2000000000000001e-11

                                            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. Applied rewrites81.5%

                                              \[\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} \]
                                            5. Taylor expanded in y around 0

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

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

                                              if 8.2000000000000001e-11 < y < 2.15e74

                                              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.f6496.1

                                                  \[\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 rewrites96.1%

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

                                              if 2.15e74 < y

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

                                                \[\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} \]
                                              5. Taylor expanded in b around 0

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

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

                                              Alternative 8: 78.4% accurate, 1.0× speedup?

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

                                                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. Applied rewrites81.5%

                                                  \[\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} \]
                                                5. Taylor expanded in y around 0

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

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

                                                  if 8.2000000000000001e-11 < y < 1.21999999999999996e86

                                                  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.f6496.7

                                                      \[\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 rewrites96.7%

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

                                                  if 1.21999999999999996e86 < y

                                                  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 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. Applied rewrites93.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} \]
                                                  5. 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 \]
                                                  6. Step-by-step derivation
                                                    1. Applied rewrites90.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 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 rewrites90.3%

                                                        \[\leadsto \mathsf{fma}\left(i, y, \mathsf{fma}\left(\log y, x, 1 \cdot z\right)\right) + a \]
                                                    4. Recombined 3 regimes into one program.
                                                    5. Add Preprocessing

                                                    Alternative 9: 84.3% 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. Applied rewrites87.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} \]
                                                    5. Add Preprocessing

                                                    Alternative 10: 92.5% accurate, 1.7× speedup?

                                                    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -9.2 \cdot 10^{+106} \lor \neg \left(x \leq 1.1 \cdot 10^{+156}\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 -9.2e+106) (not (<= x 1.1e+156)))
                                                       (+ (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 <= -9.2e+106) || !(x <= 1.1e+156)) {
                                                    		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 <= -9.2e+106) || !(x <= 1.1e+156))
                                                    		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, -9.2e+106], N[Not[LessEqual[x, 1.1e+156]], $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 -9.2 \cdot 10^{+106} \lor \neg \left(x \leq 1.1 \cdot 10^{+156}\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 < -9.2000000000000008e106 or 1.10000000000000002e156 < 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. Applied rewrites93.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} \]
                                                      5. 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 \]
                                                      6. Step-by-step derivation
                                                        1. Applied rewrites88.3%

                                                          \[\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 rewrites88.4%

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

                                                          if -9.2000000000000008e106 < x < 1.10000000000000002e156

                                                          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.f6498.5

                                                              \[\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 rewrites98.5%

                                                            \[\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 simplification95.8%

                                                          \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -9.2 \cdot 10^{+106} \lor \neg \left(x \leq 1.1 \cdot 10^{+156}\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 11: 79.5% accurate, 1.8× speedup?

                                                        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -9.2 \cdot 10^{+106} \lor \neg \left(x \leq 1.1 \cdot 10^{+156}\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 -9.2e+106) (not (<= x 1.1e+156)))
                                                           (+ (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 <= -9.2e+106) || !(x <= 1.1e+156)) {
                                                        		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 <= -9.2e+106) || !(x <= 1.1e+156))
                                                        		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, -9.2e+106], N[Not[LessEqual[x, 1.1e+156]], $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 -9.2 \cdot 10^{+106} \lor \neg \left(x \leq 1.1 \cdot 10^{+156}\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 < -9.2000000000000008e106 or 1.10000000000000002e156 < 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. Applied rewrites93.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} \]
                                                          5. 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 \]
                                                          6. Step-by-step derivation
                                                            1. Applied rewrites88.3%

                                                              \[\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 rewrites88.4%

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

                                                              if -9.2000000000000008e106 < x < 1.10000000000000002e156

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

                                                                \[\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} \]
                                                              5. Taylor expanded in x around 0

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

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

                                                                \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -9.2 \cdot 10^{+106} \lor \neg \left(x \leq 1.1 \cdot 10^{+156}\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} \]
                                                              9. Add Preprocessing

                                                              Alternative 12: 73.1% accurate, 1.8× speedup?

                                                              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -3.3 \cdot 10^{+255} \lor \neg \left(x \leq 2.15 \cdot 10^{+251}\right):\\ \;\;\;\;\log y \cdot x\\ \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 -3.3e+255) (not (<= x 2.15e+251)))
                                                                 (* (log y) x)
                                                                 (+ (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 <= -3.3e+255) || !(x <= 2.15e+251)) {
                                                              		tmp = log(y) * x;
                                                              	} 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 <= -3.3e+255) || !(x <= 2.15e+251))
                                                              		tmp = Float64(log(y) * x);
                                                              	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, -3.3e+255], N[Not[LessEqual[x, 2.15e+251]], $MachinePrecision]], N[(N[Log[y], $MachinePrecision] * x), $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 -3.3 \cdot 10^{+255} \lor \neg \left(x \leq 2.15 \cdot 10^{+251}\right):\\
                                                              \;\;\;\;\log y \cdot x\\
                                                              
                                                              \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 < -3.29999999999999982e255 or 2.15e251 < 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. Applied rewrites99.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} \]
                                                                5. Taylor expanded in x around inf

                                                                  \[\leadsto \color{blue}{x \cdot \log y} \]
                                                                6. 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.f6470.1

                                                                    \[\leadsto \color{blue}{\log y} \cdot x \]
                                                                7. Applied rewrites70.1%

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

                                                                if -3.29999999999999982e255 < x < 2.15e251

                                                                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. Applied rewrites86.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} \]
                                                                5. Taylor expanded in x around 0

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

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

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

                                                                Alternative 13: 58.7% accurate, 1.9× speedup?

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

                                                                  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. Applied rewrites85.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} \]
                                                                  5. Taylor expanded in y around 0

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

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

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

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

                                                                      if 1.2499999999999999e130 < y

                                                                      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 a around 0

                                                                        \[\leadsto \color{blue}{t + \left(z + \left(i \cdot y + \left(x \cdot \log y + \log c \cdot \left(b - \frac{1}{2}\right)\right)\right)\right)} \]
                                                                      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) + t} \]
                                                                        2. associate-+r+N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                          \[\leadsto \mathsf{fma}\left(i, y, z\right) + \mathsf{fma}\left(\log y, x, \mathsf{fma}\left(\color{blue}{b - \frac{1}{2}}, \log c, t\right)\right) \]
                                                                        16. lower-log.f64100.0

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

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

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

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

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

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

                                                                        Alternative 14: 41.3% accurate, 2.0× speedup?

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

                                                                          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. Applied rewrites85.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} \]
                                                                          5. Taylor expanded in y around 0

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

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

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

                                                                                \[\leadsto \mathsf{fma}\left(\log c, b - 0.5, z\right) + a \]
                                                                              2. Taylor expanded in z around 0

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

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

                                                                                if 1.2499999999999999e130 < y

                                                                                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 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. Applied rewrites93.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} \]
                                                                                5. 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 \]
                                                                                6. Step-by-step derivation
                                                                                  1. Applied rewrites88.9%

                                                                                    \[\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 y around inf

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

                                                                                      \[\leadsto \color{blue}{i \cdot y} \]
                                                                                  4. Applied rewrites63.6%

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

                                                                                Alternative 15: 24.4% 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 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. Applied rewrites87.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} \]
                                                                                5. 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 \]
                                                                                6. Step-by-step derivation
                                                                                  1. Applied rewrites77.8%

                                                                                    \[\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 y around inf

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

                                                                                      \[\leadsto \color{blue}{i \cdot y} \]
                                                                                  4. Applied rewrites23.6%

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

                                                                                  Reproduce

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