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

Percentage Accurate: 99.9% → 99.9%
Time: 17.6s
Alternatives: 18
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);
}
real(8) function code(x, y, z, t, a, b, c, i)
    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 18 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.9% 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);
}
real(8) function code(x, y, z, t, a, b, c, i)
    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.9% accurate, 0.4× speedup?

\[\begin{array}{l} [z, t, a] = \mathsf{sort}([z, t, a])\\ \\ \mathsf{fma}\left(y, i, \mathsf{fma}\left(b + -0.5, \log c, \mathsf{fma}\left(x, \log y, z\right) + \left(t + a\right)\right)\right) \end{array} \]
NOTE: z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i)
 :precision binary64
 (fma y i (fma (+ b -0.5) (log c) (+ (fma x (log y) z) (+ t a)))))
assert(z < t && t < a);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	return fma(y, i, fma((b + -0.5), log(c), (fma(x, log(y), z) + (t + a))));
}
z, t, a = sort([z, t, a])
function code(x, y, z, t, a, b, c, i)
	return fma(y, i, fma(Float64(b + -0.5), log(c), Float64(fma(x, log(y), z) + Float64(t + a))))
end
NOTE: z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(y * i + N[(N[(b + -0.5), $MachinePrecision] * N[Log[c], $MachinePrecision] + N[(N[(x * N[Log[y], $MachinePrecision] + z), $MachinePrecision] + N[(t + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[z, t, a] = \mathsf{sort}([z, t, a])\\
\\
\mathsf{fma}\left(y, i, \mathsf{fma}\left(b + -0.5, \log c, \mathsf{fma}\left(x, \log y, z\right) + \left(t + a\right)\right)\right)
\end{array}
Derivation
  1. Initial program 99.8%

    \[\left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \left(b - 0.5\right) \cdot \log c\right) + y \cdot i \]
  2. Step-by-step derivation
    1. +-commutative99.8%

      \[\leadsto \color{blue}{y \cdot i + \left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \left(b - 0.5\right) \cdot \log c\right)} \]
    2. fma-def99.8%

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

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

      \[\leadsto \mathsf{fma}\left(y, i, \color{blue}{\mathsf{fma}\left(b - 0.5, \log c, \left(\left(x \cdot \log y + z\right) + t\right) + a\right)}\right) \]
    5. sub-neg99.8%

      \[\leadsto \mathsf{fma}\left(y, i, \mathsf{fma}\left(\color{blue}{b + \left(-0.5\right)}, \log c, \left(\left(x \cdot \log y + z\right) + t\right) + a\right)\right) \]
    6. metadata-eval99.8%

      \[\leadsto \mathsf{fma}\left(y, i, \mathsf{fma}\left(b + \color{blue}{-0.5}, \log c, \left(\left(x \cdot \log y + z\right) + t\right) + a\right)\right) \]
    7. associate-+l+99.8%

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

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(y, i, \mathsf{fma}\left(b + -0.5, \log c, \mathsf{fma}\left(x, \log y, z\right) + \left(t + a\right)\right)\right)} \]
  4. Final simplification99.8%

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

Alternative 2: 99.9% accurate, 0.7× speedup?

\[\begin{array}{l} [z, t, a] = \mathsf{sort}([z, t, a])\\ \\ \left(\mathsf{fma}\left(x, \log y, z\right) + \left(t + a\right)\right) + \left(\left(b + -0.5\right) \cdot \log c + y \cdot i\right) \end{array} \]
NOTE: z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i)
 :precision binary64
 (+ (+ (fma x (log y) z) (+ t a)) (+ (* (+ b -0.5) (log c)) (* y i))))
assert(z < t && t < a);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	return (fma(x, log(y), z) + (t + a)) + (((b + -0.5) * log(c)) + (y * i));
}
z, t, a = sort([z, t, a])
function code(x, y, z, t, a, b, c, i)
	return Float64(Float64(fma(x, log(y), z) + Float64(t + a)) + Float64(Float64(Float64(b + -0.5) * log(c)) + Float64(y * i)))
end
NOTE: z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(N[(N[(x * N[Log[y], $MachinePrecision] + z), $MachinePrecision] + N[(t + a), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(b + -0.5), $MachinePrecision] * N[Log[c], $MachinePrecision]), $MachinePrecision] + N[(y * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[z, t, a] = \mathsf{sort}([z, t, a])\\
\\
\left(\mathsf{fma}\left(x, \log y, z\right) + \left(t + a\right)\right) + \left(\left(b + -0.5\right) \cdot \log c + y \cdot i\right)
\end{array}
Derivation
  1. Initial program 99.8%

    \[\left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \left(b - 0.5\right) \cdot \log c\right) + y \cdot i \]
  2. Step-by-step derivation
    1. associate-+l+99.8%

      \[\leadsto \color{blue}{\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \left(\left(b - 0.5\right) \cdot \log c + y \cdot i\right)} \]
    2. associate-+l+99.8%

      \[\leadsto \color{blue}{\left(\left(x \cdot \log y + z\right) + \left(t + a\right)\right)} + \left(\left(b - 0.5\right) \cdot \log c + y \cdot i\right) \]
    3. fma-def99.8%

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

      \[\leadsto \left(\mathsf{fma}\left(x, \log y, z\right) + \left(t + a\right)\right) + \left(\color{blue}{\left(b + \left(-0.5\right)\right)} \cdot \log c + y \cdot i\right) \]
    5. metadata-eval99.8%

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

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

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

Alternative 3: 99.8% accurate, 1.0× speedup?

\[\begin{array}{l} [z, t, a] = \mathsf{sort}([z, t, a])\\ \\ y \cdot i + \left(\left(a + \left(t + \left(z + x \cdot \log y\right)\right)\right) + \log \left(\frac{1}{c}\right) \cdot \left(0.5 - b\right)\right) \end{array} \]
NOTE: z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i)
 :precision binary64
 (+ (* y i) (+ (+ a (+ t (+ z (* x (log y))))) (* (log (/ 1.0 c)) (- 0.5 b)))))
assert(z < t && t < a);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	return (y * i) + ((a + (t + (z + (x * log(y))))) + (log((1.0 / c)) * (0.5 - b)));
}
NOTE: z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b, c, i)
    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 = (y * i) + ((a + (t + (z + (x * log(y))))) + (log((1.0d0 / c)) * (0.5d0 - b)))
end function
assert z < t && t < a;
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	return (y * i) + ((a + (t + (z + (x * Math.log(y))))) + (Math.log((1.0 / c)) * (0.5 - b)));
}
[z, t, a] = sort([z, t, a])
def code(x, y, z, t, a, b, c, i):
	return (y * i) + ((a + (t + (z + (x * math.log(y))))) + (math.log((1.0 / c)) * (0.5 - b)))
z, t, a = sort([z, t, a])
function code(x, y, z, t, a, b, c, i)
	return Float64(Float64(y * i) + Float64(Float64(a + Float64(t + Float64(z + Float64(x * log(y))))) + Float64(log(Float64(1.0 / c)) * Float64(0.5 - b))))
end
z, t, a = num2cell(sort([z, t, a])){:}
function tmp = code(x, y, z, t, a, b, c, i)
	tmp = (y * i) + ((a + (t + (z + (x * log(y))))) + (log((1.0 / c)) * (0.5 - b)));
end
NOTE: z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(N[(y * i), $MachinePrecision] + N[(N[(a + N[(t + N[(z + N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Log[N[(1.0 / c), $MachinePrecision]], $MachinePrecision] * N[(0.5 - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[z, t, a] = \mathsf{sort}([z, t, a])\\
\\
y \cdot i + \left(\left(a + \left(t + \left(z + x \cdot \log y\right)\right)\right) + \log \left(\frac{1}{c}\right) \cdot \left(0.5 - b\right)\right)
\end{array}
Derivation
  1. Initial program 99.8%

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

    \[\leadsto \left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \color{blue}{-1 \cdot \left(\left(b - 0.5\right) \cdot \log \left(\frac{1}{c}\right)\right)}\right) + y \cdot i \]
  3. Final simplification99.8%

    \[\leadsto y \cdot i + \left(\left(a + \left(t + \left(z + x \cdot \log y\right)\right)\right) + \log \left(\frac{1}{c}\right) \cdot \left(0.5 - b\right)\right) \]

Alternative 4: 93.4% accurate, 1.0× speedup?

\[\begin{array}{l} [z, t, a] = \mathsf{sort}([z, t, a])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -6 \cdot 10^{+129} \lor \neg \left(x \leq 4.5 \cdot 10^{+91}\right):\\ \;\;\;\;y \cdot i + \left(x \cdot \log y + \left(t + \left(z + b \cdot \log c\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot i + \left(\log c \cdot \left(b - 0.5\right) + \left(a + \left(z + t\right)\right)\right)\\ \end{array} \end{array} \]
NOTE: z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i)
 :precision binary64
 (if (or (<= x -6e+129) (not (<= x 4.5e+91)))
   (+ (* y i) (+ (* x (log y)) (+ t (+ z (* b (log c))))))
   (+ (* y i) (+ (* (log c) (- b 0.5)) (+ a (+ z t))))))
assert(z < t && t < a);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if ((x <= -6e+129) || !(x <= 4.5e+91)) {
		tmp = (y * i) + ((x * log(y)) + (t + (z + (b * log(c)))));
	} else {
		tmp = (y * i) + ((log(c) * (b - 0.5)) + (a + (z + t)));
	}
	return tmp;
}
NOTE: z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b, c, i)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: i
    real(8) :: tmp
    if ((x <= (-6d+129)) .or. (.not. (x <= 4.5d+91))) then
        tmp = (y * i) + ((x * log(y)) + (t + (z + (b * log(c)))))
    else
        tmp = (y * i) + ((log(c) * (b - 0.5d0)) + (a + (z + t)))
    end if
    code = tmp
end function
assert z < t && t < a;
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if ((x <= -6e+129) || !(x <= 4.5e+91)) {
		tmp = (y * i) + ((x * Math.log(y)) + (t + (z + (b * Math.log(c)))));
	} else {
		tmp = (y * i) + ((Math.log(c) * (b - 0.5)) + (a + (z + t)));
	}
	return tmp;
}
[z, t, a] = sort([z, t, a])
def code(x, y, z, t, a, b, c, i):
	tmp = 0
	if (x <= -6e+129) or not (x <= 4.5e+91):
		tmp = (y * i) + ((x * math.log(y)) + (t + (z + (b * math.log(c)))))
	else:
		tmp = (y * i) + ((math.log(c) * (b - 0.5)) + (a + (z + t)))
	return tmp
z, t, a = sort([z, t, a])
function code(x, y, z, t, a, b, c, i)
	tmp = 0.0
	if ((x <= -6e+129) || !(x <= 4.5e+91))
		tmp = Float64(Float64(y * i) + Float64(Float64(x * log(y)) + Float64(t + Float64(z + Float64(b * log(c))))));
	else
		tmp = Float64(Float64(y * i) + Float64(Float64(log(c) * Float64(b - 0.5)) + Float64(a + Float64(z + t))));
	end
	return tmp
end
z, t, a = num2cell(sort([z, t, a])){:}
function tmp_2 = code(x, y, z, t, a, b, c, i)
	tmp = 0.0;
	if ((x <= -6e+129) || ~((x <= 4.5e+91)))
		tmp = (y * i) + ((x * log(y)) + (t + (z + (b * log(c)))));
	else
		tmp = (y * i) + ((log(c) * (b - 0.5)) + (a + (z + t)));
	end
	tmp_2 = tmp;
end
NOTE: z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[x, -6e+129], N[Not[LessEqual[x, 4.5e+91]], $MachinePrecision]], N[(N[(y * i), $MachinePrecision] + N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(t + N[(z + N[(b * N[Log[c], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * i), $MachinePrecision] + N[(N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision]), $MachinePrecision] + N[(a + N[(z + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[z, t, a] = \mathsf{sort}([z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6 \cdot 10^{+129} \lor \neg \left(x \leq 4.5 \cdot 10^{+91}\right):\\
\;\;\;\;y \cdot i + \left(x \cdot \log y + \left(t + \left(z + b \cdot \log c\right)\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -6.0000000000000006e129 or 4.5e91 < x

    1. Initial program 99.7%

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

      \[\leadsto \left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \color{blue}{\log c \cdot b}\right) + y \cdot i \]
    3. Taylor expanded in a around 0 91.7%

      \[\leadsto \color{blue}{\left(\log y \cdot x + \left(t + \left(\log c \cdot b + z\right)\right)\right)} + y \cdot i \]

    if -6.0000000000000006e129 < x < 4.5e91

    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. Taylor expanded in x around 0 98.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -6 \cdot 10^{+129} \lor \neg \left(x \leq 4.5 \cdot 10^{+91}\right):\\ \;\;\;\;y \cdot i + \left(x \cdot \log y + \left(t + \left(z + b \cdot \log c\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot i + \left(\log c \cdot \left(b - 0.5\right) + \left(a + \left(z + t\right)\right)\right)\\ \end{array} \]

Alternative 5: 99.9% accurate, 1.0× speedup?

\[\begin{array}{l} [z, t, a] = \mathsf{sort}([z, t, a])\\ \\ y \cdot i + \left(\left(a + \left(t + \left(z + x \cdot \log y\right)\right)\right) + \log c \cdot \left(b - 0.5\right)\right) \end{array} \]
NOTE: z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i)
 :precision binary64
 (+ (* y i) (+ (+ a (+ t (+ z (* x (log y))))) (* (log c) (- b 0.5)))))
assert(z < t && t < a);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	return (y * i) + ((a + (t + (z + (x * log(y))))) + (log(c) * (b - 0.5)));
}
NOTE: z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b, c, i)
    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 = (y * i) + ((a + (t + (z + (x * log(y))))) + (log(c) * (b - 0.5d0)))
end function
assert z < t && t < a;
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	return (y * i) + ((a + (t + (z + (x * Math.log(y))))) + (Math.log(c) * (b - 0.5)));
}
[z, t, a] = sort([z, t, a])
def code(x, y, z, t, a, b, c, i):
	return (y * i) + ((a + (t + (z + (x * math.log(y))))) + (math.log(c) * (b - 0.5)))
z, t, a = sort([z, t, a])
function code(x, y, z, t, a, b, c, i)
	return Float64(Float64(y * i) + Float64(Float64(a + Float64(t + Float64(z + Float64(x * log(y))))) + Float64(log(c) * Float64(b - 0.5))))
end
z, t, a = num2cell(sort([z, t, a])){:}
function tmp = code(x, y, z, t, a, b, c, i)
	tmp = (y * i) + ((a + (t + (z + (x * log(y))))) + (log(c) * (b - 0.5)));
end
NOTE: z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(N[(y * i), $MachinePrecision] + N[(N[(a + N[(t + N[(z + N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[z, t, a] = \mathsf{sort}([z, t, a])\\
\\
y \cdot i + \left(\left(a + \left(t + \left(z + x \cdot \log y\right)\right)\right) + \log c \cdot \left(b - 0.5\right)\right)
\end{array}
Derivation
  1. Initial program 99.8%

    \[\left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \left(b - 0.5\right) \cdot \log c\right) + y \cdot i \]
  2. Final simplification99.8%

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

Alternative 6: 98.3% accurate, 1.0× speedup?

\[\begin{array}{l} [z, t, a] = \mathsf{sort}([z, t, a])\\ \\ y \cdot i + \left(\left(a + \left(t + \left(z + x \cdot \log y\right)\right)\right) + b \cdot \log c\right) \end{array} \]
NOTE: z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i)
 :precision binary64
 (+ (* y i) (+ (+ a (+ t (+ z (* x (log y))))) (* b (log c)))))
assert(z < t && t < a);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	return (y * i) + ((a + (t + (z + (x * log(y))))) + (b * log(c)));
}
NOTE: z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b, c, i)
    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 = (y * i) + ((a + (t + (z + (x * log(y))))) + (b * log(c)))
end function
assert z < t && t < a;
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	return (y * i) + ((a + (t + (z + (x * Math.log(y))))) + (b * Math.log(c)));
}
[z, t, a] = sort([z, t, a])
def code(x, y, z, t, a, b, c, i):
	return (y * i) + ((a + (t + (z + (x * math.log(y))))) + (b * math.log(c)))
z, t, a = sort([z, t, a])
function code(x, y, z, t, a, b, c, i)
	return Float64(Float64(y * i) + Float64(Float64(a + Float64(t + Float64(z + Float64(x * log(y))))) + Float64(b * log(c))))
end
z, t, a = num2cell(sort([z, t, a])){:}
function tmp = code(x, y, z, t, a, b, c, i)
	tmp = (y * i) + ((a + (t + (z + (x * log(y))))) + (b * log(c)));
end
NOTE: z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(N[(y * i), $MachinePrecision] + N[(N[(a + N[(t + N[(z + N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(b * N[Log[c], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[z, t, a] = \mathsf{sort}([z, t, a])\\
\\
y \cdot i + \left(\left(a + \left(t + \left(z + x \cdot \log y\right)\right)\right) + b \cdot \log c\right)
\end{array}
Derivation
  1. Initial program 99.8%

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

    \[\leadsto \left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \color{blue}{\log c \cdot b}\right) + y \cdot i \]
  3. Final simplification98.3%

    \[\leadsto y \cdot i + \left(\left(a + \left(t + \left(z + x \cdot \log y\right)\right)\right) + b \cdot \log c\right) \]

Alternative 7: 95.1% accurate, 1.0× speedup?

\[\begin{array}{l} [z, t, a] = \mathsf{sort}([z, t, a])\\ \\ \begin{array}{l} t_1 := a + \left(z + t\right)\\ \mathbf{if}\;x \leq -1.65 \cdot 10^{+152}:\\ \;\;\;\;y \cdot i + \left(x \cdot \log y + t_1\right)\\ \mathbf{elif}\;x \leq 5 \cdot 10^{+60}:\\ \;\;\;\;y \cdot i + \left(\log c \cdot \left(b - 0.5\right) + t_1\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot i + \mathsf{fma}\left(\log y, x, t_1\right)\\ \end{array} \end{array} \]
NOTE: z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i)
 :precision binary64
 (let* ((t_1 (+ a (+ z t))))
   (if (<= x -1.65e+152)
     (+ (* y i) (+ (* x (log y)) t_1))
     (if (<= x 5e+60)
       (+ (* y i) (+ (* (log c) (- b 0.5)) t_1))
       (+ (* y i) (fma (log y) x t_1))))))
assert(z < t && t < a);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = a + (z + t);
	double tmp;
	if (x <= -1.65e+152) {
		tmp = (y * i) + ((x * log(y)) + t_1);
	} else if (x <= 5e+60) {
		tmp = (y * i) + ((log(c) * (b - 0.5)) + t_1);
	} else {
		tmp = (y * i) + fma(log(y), x, t_1);
	}
	return tmp;
}
z, t, a = sort([z, t, a])
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(a + Float64(z + t))
	tmp = 0.0
	if (x <= -1.65e+152)
		tmp = Float64(Float64(y * i) + Float64(Float64(x * log(y)) + t_1));
	elseif (x <= 5e+60)
		tmp = Float64(Float64(y * i) + Float64(Float64(log(c) * Float64(b - 0.5)) + t_1));
	else
		tmp = Float64(Float64(y * i) + fma(log(y), x, t_1));
	end
	return tmp
end
NOTE: z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(a + N[(z + t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.65e+152], N[(N[(y * i), $MachinePrecision] + N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5e+60], N[(N[(y * i), $MachinePrecision] + N[(N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(y * i), $MachinePrecision] + N[(N[Log[y], $MachinePrecision] * x + t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[z, t, a] = \mathsf{sort}([z, t, a])\\
\\
\begin{array}{l}
t_1 := a + \left(z + t\right)\\
\mathbf{if}\;x \leq -1.65 \cdot 10^{+152}:\\
\;\;\;\;y \cdot i + \left(x \cdot \log y + t_1\right)\\

\mathbf{elif}\;x \leq 5 \cdot 10^{+60}:\\
\;\;\;\;y \cdot i + \left(\log c \cdot \left(b - 0.5\right) + t_1\right)\\

\mathbf{else}:\\
\;\;\;\;y \cdot i + \mathsf{fma}\left(\log y, x, t_1\right)\\


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

    1. Initial program 99.7%

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

      \[\leadsto \left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \color{blue}{\log c \cdot b}\right) + y \cdot i \]
    3. Taylor expanded in b around 0 86.8%

      \[\leadsto \color{blue}{\left(\log y \cdot x + \left(a + \left(t + z\right)\right)\right)} + y \cdot i \]

    if -1.6500000000000001e152 < x < 4.99999999999999975e60

    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. Taylor expanded in x around 0 98.3%

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

    if 4.99999999999999975e60 < x

    1. Initial program 99.8%

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

      \[\leadsto \left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \color{blue}{\log c \cdot b}\right) + y \cdot i \]
    3. Taylor expanded in b around 0 87.8%

      \[\leadsto \color{blue}{\left(\log y \cdot x + \left(a + \left(t + z\right)\right)\right)} + y \cdot i \]
    4. Step-by-step derivation
      1. fma-def87.8%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, x, a + \left(t + z\right)\right)} + y \cdot i \]
    5. Simplified87.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, x, a + \left(t + z\right)\right)} + y \cdot i \]
  3. Recombined 3 regimes into one program.
  4. Final simplification94.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.65 \cdot 10^{+152}:\\ \;\;\;\;y \cdot i + \left(x \cdot \log y + \left(a + \left(z + t\right)\right)\right)\\ \mathbf{elif}\;x \leq 5 \cdot 10^{+60}:\\ \;\;\;\;y \cdot i + \left(\log c \cdot \left(b - 0.5\right) + \left(a + \left(z + t\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot i + \mathsf{fma}\left(\log y, x, a + \left(z + t\right)\right)\\ \end{array} \]

Alternative 8: 95.1% accurate, 1.8× speedup?

\[\begin{array}{l} [z, t, a] = \mathsf{sort}([z, t, a])\\ \\ \begin{array}{l} t_1 := a + \left(z + t\right)\\ \mathbf{if}\;x \leq -3.8 \cdot 10^{+156} \lor \neg \left(x \leq 9 \cdot 10^{+60}\right):\\ \;\;\;\;y \cdot i + \left(x \cdot \log y + t_1\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot i + \left(\log c \cdot \left(b - 0.5\right) + t_1\right)\\ \end{array} \end{array} \]
NOTE: z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i)
 :precision binary64
 (let* ((t_1 (+ a (+ z t))))
   (if (or (<= x -3.8e+156) (not (<= x 9e+60)))
     (+ (* y i) (+ (* x (log y)) t_1))
     (+ (* y i) (+ (* (log c) (- b 0.5)) t_1)))))
assert(z < t && t < a);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = a + (z + t);
	double tmp;
	if ((x <= -3.8e+156) || !(x <= 9e+60)) {
		tmp = (y * i) + ((x * log(y)) + t_1);
	} else {
		tmp = (y * i) + ((log(c) * (b - 0.5)) + t_1);
	}
	return tmp;
}
NOTE: z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b, c, i)
    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 = a + (z + t)
    if ((x <= (-3.8d+156)) .or. (.not. (x <= 9d+60))) then
        tmp = (y * i) + ((x * log(y)) + t_1)
    else
        tmp = (y * i) + ((log(c) * (b - 0.5d0)) + t_1)
    end if
    code = tmp
end function
assert z < t && t < a;
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = a + (z + t);
	double tmp;
	if ((x <= -3.8e+156) || !(x <= 9e+60)) {
		tmp = (y * i) + ((x * Math.log(y)) + t_1);
	} else {
		tmp = (y * i) + ((Math.log(c) * (b - 0.5)) + t_1);
	}
	return tmp;
}
[z, t, a] = sort([z, t, a])
def code(x, y, z, t, a, b, c, i):
	t_1 = a + (z + t)
	tmp = 0
	if (x <= -3.8e+156) or not (x <= 9e+60):
		tmp = (y * i) + ((x * math.log(y)) + t_1)
	else:
		tmp = (y * i) + ((math.log(c) * (b - 0.5)) + t_1)
	return tmp
z, t, a = sort([z, t, a])
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(a + Float64(z + t))
	tmp = 0.0
	if ((x <= -3.8e+156) || !(x <= 9e+60))
		tmp = Float64(Float64(y * i) + Float64(Float64(x * log(y)) + t_1));
	else
		tmp = Float64(Float64(y * i) + Float64(Float64(log(c) * Float64(b - 0.5)) + t_1));
	end
	return tmp
end
z, t, a = num2cell(sort([z, t, a])){:}
function tmp_2 = code(x, y, z, t, a, b, c, i)
	t_1 = a + (z + t);
	tmp = 0.0;
	if ((x <= -3.8e+156) || ~((x <= 9e+60)))
		tmp = (y * i) + ((x * log(y)) + t_1);
	else
		tmp = (y * i) + ((log(c) * (b - 0.5)) + t_1);
	end
	tmp_2 = tmp;
end
NOTE: z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(a + N[(z + t), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[x, -3.8e+156], N[Not[LessEqual[x, 9e+60]], $MachinePrecision]], N[(N[(y * i), $MachinePrecision] + N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(y * i), $MachinePrecision] + N[(N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[z, t, a] = \mathsf{sort}([z, t, a])\\
\\
\begin{array}{l}
t_1 := a + \left(z + t\right)\\
\mathbf{if}\;x \leq -3.8 \cdot 10^{+156} \lor \neg \left(x \leq 9 \cdot 10^{+60}\right):\\
\;\;\;\;y \cdot i + \left(x \cdot \log y + t_1\right)\\

\mathbf{else}:\\
\;\;\;\;y \cdot i + \left(\log c \cdot \left(b - 0.5\right) + t_1\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -3.80000000000000024e156 or 9.00000000000000026e60 < x

    1. Initial program 99.7%

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

      \[\leadsto \left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \color{blue}{\log c \cdot b}\right) + y \cdot i \]
    3. Taylor expanded in b around 0 87.4%

      \[\leadsto \color{blue}{\left(\log y \cdot x + \left(a + \left(t + z\right)\right)\right)} + y \cdot i \]

    if -3.80000000000000024e156 < x < 9.00000000000000026e60

    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. Taylor expanded in x around 0 98.3%

      \[\leadsto \color{blue}{\left(\left(b - 0.5\right) \cdot \log c + \left(a + \left(t + z\right)\right)\right)} + y \cdot i \]
  3. Recombined 2 regimes into one program.
  4. Final simplification94.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -3.8 \cdot 10^{+156} \lor \neg \left(x \leq 9 \cdot 10^{+60}\right):\\ \;\;\;\;y \cdot i + \left(x \cdot \log y + \left(a + \left(z + t\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot i + \left(\log c \cdot \left(b - 0.5\right) + \left(a + \left(z + t\right)\right)\right)\\ \end{array} \]

Alternative 9: 57.3% accurate, 1.9× speedup?

\[\begin{array}{l} [z, t, a] = \mathsf{sort}([z, t, a])\\ \\ \begin{array}{l} t_1 := y \cdot i + x \cdot \log y\\ \mathbf{if}\;z \leq -2.35 \cdot 10^{+142}:\\ \;\;\;\;z + y \cdot i\\ \mathbf{elif}\;z \leq -3.6 \cdot 10^{+34}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -1.6 \cdot 10^{-183}:\\ \;\;\;\;y \cdot i + b \cdot \log c\\ \mathbf{elif}\;z \leq -1.85 \cdot 10^{-214}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -4.2 \cdot 10^{-262}:\\ \;\;\;\;z + \log c \cdot \left(b - 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;a + y \cdot i\\ \end{array} \end{array} \]
NOTE: z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i)
 :precision binary64
 (let* ((t_1 (+ (* y i) (* x (log y)))))
   (if (<= z -2.35e+142)
     (+ z (* y i))
     (if (<= z -3.6e+34)
       t_1
       (if (<= z -1.6e-183)
         (+ (* y i) (* b (log c)))
         (if (<= z -1.85e-214)
           t_1
           (if (<= z -4.2e-262)
             (+ z (* (log c) (- b 0.5)))
             (+ a (* y i)))))))))
assert(z < t && t < a);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = (y * i) + (x * log(y));
	double tmp;
	if (z <= -2.35e+142) {
		tmp = z + (y * i);
	} else if (z <= -3.6e+34) {
		tmp = t_1;
	} else if (z <= -1.6e-183) {
		tmp = (y * i) + (b * log(c));
	} else if (z <= -1.85e-214) {
		tmp = t_1;
	} else if (z <= -4.2e-262) {
		tmp = z + (log(c) * (b - 0.5));
	} else {
		tmp = a + (y * i);
	}
	return tmp;
}
NOTE: z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b, c, i)
    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 = (y * i) + (x * log(y))
    if (z <= (-2.35d+142)) then
        tmp = z + (y * i)
    else if (z <= (-3.6d+34)) then
        tmp = t_1
    else if (z <= (-1.6d-183)) then
        tmp = (y * i) + (b * log(c))
    else if (z <= (-1.85d-214)) then
        tmp = t_1
    else if (z <= (-4.2d-262)) then
        tmp = z + (log(c) * (b - 0.5d0))
    else
        tmp = a + (y * i)
    end if
    code = tmp
end function
assert z < t && t < a;
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = (y * i) + (x * Math.log(y));
	double tmp;
	if (z <= -2.35e+142) {
		tmp = z + (y * i);
	} else if (z <= -3.6e+34) {
		tmp = t_1;
	} else if (z <= -1.6e-183) {
		tmp = (y * i) + (b * Math.log(c));
	} else if (z <= -1.85e-214) {
		tmp = t_1;
	} else if (z <= -4.2e-262) {
		tmp = z + (Math.log(c) * (b - 0.5));
	} else {
		tmp = a + (y * i);
	}
	return tmp;
}
[z, t, a] = sort([z, t, a])
def code(x, y, z, t, a, b, c, i):
	t_1 = (y * i) + (x * math.log(y))
	tmp = 0
	if z <= -2.35e+142:
		tmp = z + (y * i)
	elif z <= -3.6e+34:
		tmp = t_1
	elif z <= -1.6e-183:
		tmp = (y * i) + (b * math.log(c))
	elif z <= -1.85e-214:
		tmp = t_1
	elif z <= -4.2e-262:
		tmp = z + (math.log(c) * (b - 0.5))
	else:
		tmp = a + (y * i)
	return tmp
z, t, a = sort([z, t, a])
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(Float64(y * i) + Float64(x * log(y)))
	tmp = 0.0
	if (z <= -2.35e+142)
		tmp = Float64(z + Float64(y * i));
	elseif (z <= -3.6e+34)
		tmp = t_1;
	elseif (z <= -1.6e-183)
		tmp = Float64(Float64(y * i) + Float64(b * log(c)));
	elseif (z <= -1.85e-214)
		tmp = t_1;
	elseif (z <= -4.2e-262)
		tmp = Float64(z + Float64(log(c) * Float64(b - 0.5)));
	else
		tmp = Float64(a + Float64(y * i));
	end
	return tmp
end
z, t, a = num2cell(sort([z, t, a])){:}
function tmp_2 = code(x, y, z, t, a, b, c, i)
	t_1 = (y * i) + (x * log(y));
	tmp = 0.0;
	if (z <= -2.35e+142)
		tmp = z + (y * i);
	elseif (z <= -3.6e+34)
		tmp = t_1;
	elseif (z <= -1.6e-183)
		tmp = (y * i) + (b * log(c));
	elseif (z <= -1.85e-214)
		tmp = t_1;
	elseif (z <= -4.2e-262)
		tmp = z + (log(c) * (b - 0.5));
	else
		tmp = a + (y * i);
	end
	tmp_2 = tmp;
end
NOTE: z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(y * i), $MachinePrecision] + N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.35e+142], N[(z + N[(y * i), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -3.6e+34], t$95$1, If[LessEqual[z, -1.6e-183], N[(N[(y * i), $MachinePrecision] + N[(b * N[Log[c], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -1.85e-214], t$95$1, If[LessEqual[z, -4.2e-262], N[(z + N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(y * i), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[z, t, a] = \mathsf{sort}([z, t, a])\\
\\
\begin{array}{l}
t_1 := y \cdot i + x \cdot \log y\\
\mathbf{if}\;z \leq -2.35 \cdot 10^{+142}:\\
\;\;\;\;z + y \cdot i\\

\mathbf{elif}\;z \leq -3.6 \cdot 10^{+34}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq -1.6 \cdot 10^{-183}:\\
\;\;\;\;y \cdot i + b \cdot \log c\\

\mathbf{elif}\;z \leq -1.85 \cdot 10^{-214}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq -4.2 \cdot 10^{-262}:\\
\;\;\;\;z + \log c \cdot \left(b - 0.5\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if z < -2.35e142

    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. Taylor expanded in z around inf 66.7%

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

    if -2.35e142 < z < -3.6e34 or -1.6000000000000001e-183 < z < -1.8500000000000001e-214

    1. Initial program 99.7%

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

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

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

    if -3.6e34 < z < -1.6000000000000001e-183

    1. Initial program 99.8%

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

      \[\leadsto \color{blue}{\left(\left(b - 0.5\right) \cdot \log c + \left(a + \left(t + z\right)\right)\right)} + y \cdot i \]
    3. Taylor expanded in b around inf 52.5%

      \[\leadsto \color{blue}{\log c \cdot b} + y \cdot i \]

    if -1.8500000000000001e-214 < z < -4.1999999999999999e-262

    1. Initial program 99.6%

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

      \[\leadsto \color{blue}{\left(\left(b - 0.5\right) \cdot \log c + \left(a + \left(t + z\right)\right)\right)} + y \cdot i \]
    3. Taylor expanded in a around 0 57.7%

      \[\leadsto \color{blue}{\left(\log c \cdot \left(b - 0.5\right) + \left(t + z\right)\right)} + y \cdot i \]
    4. Step-by-step derivation
      1. fma-def57.7%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\log c, b - 0.5, t + z\right)} + y \cdot i \]
      2. sub-neg57.7%

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

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

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

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

      \[\leadsto \color{blue}{\log c \cdot \left(b - 0.5\right) + \left(t + z\right)} \]
    7. Taylor expanded in t around 0 30.3%

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

    if -4.1999999999999999e-262 < z

    1. Initial program 99.8%

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

      \[\leadsto \color{blue}{a} + y \cdot i \]
  3. Recombined 5 regimes into one program.
  4. Final simplification47.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.35 \cdot 10^{+142}:\\ \;\;\;\;z + y \cdot i\\ \mathbf{elif}\;z \leq -3.6 \cdot 10^{+34}:\\ \;\;\;\;y \cdot i + x \cdot \log y\\ \mathbf{elif}\;z \leq -1.6 \cdot 10^{-183}:\\ \;\;\;\;y \cdot i + b \cdot \log c\\ \mathbf{elif}\;z \leq -1.85 \cdot 10^{-214}:\\ \;\;\;\;y \cdot i + x \cdot \log y\\ \mathbf{elif}\;z \leq -4.2 \cdot 10^{-262}:\\ \;\;\;\;z + \log c \cdot \left(b - 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;a + y \cdot i\\ \end{array} \]

Alternative 10: 72.4% accurate, 1.9× speedup?

\[\begin{array}{l} [z, t, a] = \mathsf{sort}([z, t, a])\\ \\ \begin{array}{l} t_1 := y \cdot i + \left(x \cdot \log y + \left(z + t\right)\right)\\ \mathbf{if}\;a \leq 7 \cdot 10^{-155}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq 2.25 \cdot 10^{-127}:\\ \;\;\;\;z + \log c \cdot \left(b - 0.5\right)\\ \mathbf{elif}\;a \leq 1.5 \cdot 10^{+192}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;a + y \cdot i\\ \end{array} \end{array} \]
NOTE: z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i)
 :precision binary64
 (let* ((t_1 (+ (* y i) (+ (* x (log y)) (+ z t)))))
   (if (<= a 7e-155)
     t_1
     (if (<= a 2.25e-127)
       (+ z (* (log c) (- b 0.5)))
       (if (<= a 1.5e+192) t_1 (+ a (* y i)))))))
assert(z < t && t < a);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = (y * i) + ((x * log(y)) + (z + t));
	double tmp;
	if (a <= 7e-155) {
		tmp = t_1;
	} else if (a <= 2.25e-127) {
		tmp = z + (log(c) * (b - 0.5));
	} else if (a <= 1.5e+192) {
		tmp = t_1;
	} else {
		tmp = a + (y * i);
	}
	return tmp;
}
NOTE: z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b, c, i)
    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 = (y * i) + ((x * log(y)) + (z + t))
    if (a <= 7d-155) then
        tmp = t_1
    else if (a <= 2.25d-127) then
        tmp = z + (log(c) * (b - 0.5d0))
    else if (a <= 1.5d+192) then
        tmp = t_1
    else
        tmp = a + (y * i)
    end if
    code = tmp
end function
assert z < t && t < a;
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = (y * i) + ((x * Math.log(y)) + (z + t));
	double tmp;
	if (a <= 7e-155) {
		tmp = t_1;
	} else if (a <= 2.25e-127) {
		tmp = z + (Math.log(c) * (b - 0.5));
	} else if (a <= 1.5e+192) {
		tmp = t_1;
	} else {
		tmp = a + (y * i);
	}
	return tmp;
}
[z, t, a] = sort([z, t, a])
def code(x, y, z, t, a, b, c, i):
	t_1 = (y * i) + ((x * math.log(y)) + (z + t))
	tmp = 0
	if a <= 7e-155:
		tmp = t_1
	elif a <= 2.25e-127:
		tmp = z + (math.log(c) * (b - 0.5))
	elif a <= 1.5e+192:
		tmp = t_1
	else:
		tmp = a + (y * i)
	return tmp
z, t, a = sort([z, t, a])
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(Float64(y * i) + Float64(Float64(x * log(y)) + Float64(z + t)))
	tmp = 0.0
	if (a <= 7e-155)
		tmp = t_1;
	elseif (a <= 2.25e-127)
		tmp = Float64(z + Float64(log(c) * Float64(b - 0.5)));
	elseif (a <= 1.5e+192)
		tmp = t_1;
	else
		tmp = Float64(a + Float64(y * i));
	end
	return tmp
end
z, t, a = num2cell(sort([z, t, a])){:}
function tmp_2 = code(x, y, z, t, a, b, c, i)
	t_1 = (y * i) + ((x * log(y)) + (z + t));
	tmp = 0.0;
	if (a <= 7e-155)
		tmp = t_1;
	elseif (a <= 2.25e-127)
		tmp = z + (log(c) * (b - 0.5));
	elseif (a <= 1.5e+192)
		tmp = t_1;
	else
		tmp = a + (y * i);
	end
	tmp_2 = tmp;
end
NOTE: z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(y * i), $MachinePrecision] + N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(z + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, 7e-155], t$95$1, If[LessEqual[a, 2.25e-127], N[(z + N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 1.5e+192], t$95$1, N[(a + N[(y * i), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[z, t, a] = \mathsf{sort}([z, t, a])\\
\\
\begin{array}{l}
t_1 := y \cdot i + \left(x \cdot \log y + \left(z + t\right)\right)\\
\mathbf{if}\;a \leq 7 \cdot 10^{-155}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;a \leq 2.25 \cdot 10^{-127}:\\
\;\;\;\;z + \log c \cdot \left(b - 0.5\right)\\

\mathbf{elif}\;a \leq 1.5 \cdot 10^{+192}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if a < 7.00000000000000031e-155 or 2.25e-127 < a < 1.5e192

    1. Initial program 99.8%

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

      \[\leadsto \left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \color{blue}{\log c \cdot b}\right) + y \cdot i \]
    3. Taylor expanded in a around 0 88.4%

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

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

    if 7.00000000000000031e-155 < a < 2.25e-127

    1. Initial program 99.7%

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

      \[\leadsto \color{blue}{\left(\left(b - 0.5\right) \cdot \log c + \left(a + \left(t + z\right)\right)\right)} + y \cdot i \]
    3. Taylor expanded in a around 0 99.7%

      \[\leadsto \color{blue}{\left(\log c \cdot \left(b - 0.5\right) + \left(t + z\right)\right)} + y \cdot i \]
    4. Step-by-step derivation
      1. fma-def99.7%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\log c, b - 0.5, t + z\right)} + y \cdot i \]
      2. sub-neg99.7%

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

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

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

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

      \[\leadsto \color{blue}{\log c \cdot \left(b - 0.5\right) + \left(t + z\right)} \]
    7. Taylor expanded in t around 0 83.1%

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

    if 1.5e192 < a

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

      \[\leadsto \color{blue}{a} + y \cdot i \]
  3. Recombined 3 regimes into one program.
  4. Final simplification71.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq 7 \cdot 10^{-155}:\\ \;\;\;\;y \cdot i + \left(x \cdot \log y + \left(z + t\right)\right)\\ \mathbf{elif}\;a \leq 2.25 \cdot 10^{-127}:\\ \;\;\;\;z + \log c \cdot \left(b - 0.5\right)\\ \mathbf{elif}\;a \leq 1.5 \cdot 10^{+192}:\\ \;\;\;\;y \cdot i + \left(x \cdot \log y + \left(z + t\right)\right)\\ \mathbf{else}:\\ \;\;\;\;a + y \cdot i\\ \end{array} \]

Alternative 11: 90.5% accurate, 1.9× speedup?

\[\begin{array}{l} [z, t, a] = \mathsf{sort}([z, t, a])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -2.8 \cdot 10^{+153} \lor \neg \left(x \leq 4.9 \cdot 10^{+91}\right):\\ \;\;\;\;y \cdot i + \left(x \cdot \log y + \left(z + t\right)\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot i + \left(a + \left(z + \log c \cdot \left(b - 0.5\right)\right)\right)\\ \end{array} \end{array} \]
NOTE: z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i)
 :precision binary64
 (if (or (<= x -2.8e+153) (not (<= x 4.9e+91)))
   (+ (* y i) (+ (* x (log y)) (+ z t)))
   (+ (* y i) (+ a (+ z (* (log c) (- b 0.5)))))))
assert(z < t && t < a);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if ((x <= -2.8e+153) || !(x <= 4.9e+91)) {
		tmp = (y * i) + ((x * log(y)) + (z + t));
	} else {
		tmp = (y * i) + (a + (z + (log(c) * (b - 0.5))));
	}
	return tmp;
}
NOTE: z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b, c, i)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: i
    real(8) :: tmp
    if ((x <= (-2.8d+153)) .or. (.not. (x <= 4.9d+91))) then
        tmp = (y * i) + ((x * log(y)) + (z + t))
    else
        tmp = (y * i) + (a + (z + (log(c) * (b - 0.5d0))))
    end if
    code = tmp
end function
assert z < t && t < a;
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if ((x <= -2.8e+153) || !(x <= 4.9e+91)) {
		tmp = (y * i) + ((x * Math.log(y)) + (z + t));
	} else {
		tmp = (y * i) + (a + (z + (Math.log(c) * (b - 0.5))));
	}
	return tmp;
}
[z, t, a] = sort([z, t, a])
def code(x, y, z, t, a, b, c, i):
	tmp = 0
	if (x <= -2.8e+153) or not (x <= 4.9e+91):
		tmp = (y * i) + ((x * math.log(y)) + (z + t))
	else:
		tmp = (y * i) + (a + (z + (math.log(c) * (b - 0.5))))
	return tmp
z, t, a = sort([z, t, a])
function code(x, y, z, t, a, b, c, i)
	tmp = 0.0
	if ((x <= -2.8e+153) || !(x <= 4.9e+91))
		tmp = Float64(Float64(y * i) + Float64(Float64(x * log(y)) + Float64(z + t)));
	else
		tmp = Float64(Float64(y * i) + Float64(a + Float64(z + Float64(log(c) * Float64(b - 0.5)))));
	end
	return tmp
end
z, t, a = num2cell(sort([z, t, a])){:}
function tmp_2 = code(x, y, z, t, a, b, c, i)
	tmp = 0.0;
	if ((x <= -2.8e+153) || ~((x <= 4.9e+91)))
		tmp = (y * i) + ((x * log(y)) + (z + t));
	else
		tmp = (y * i) + (a + (z + (log(c) * (b - 0.5))));
	end
	tmp_2 = tmp;
end
NOTE: z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[x, -2.8e+153], N[Not[LessEqual[x, 4.9e+91]], $MachinePrecision]], N[(N[(y * i), $MachinePrecision] + N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(z + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * i), $MachinePrecision] + N[(a + N[(z + N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[z, t, a] = \mathsf{sort}([z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.8 \cdot 10^{+153} \lor \neg \left(x \leq 4.9 \cdot 10^{+91}\right):\\
\;\;\;\;y \cdot i + \left(x \cdot \log y + \left(z + t\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.79999999999999985e153 or 4.9000000000000003e91 < x

    1. Initial program 99.7%

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

      \[\leadsto \left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \color{blue}{\log c \cdot b}\right) + y \cdot i \]
    3. Taylor expanded in a around 0 91.2%

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

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

    if -2.79999999999999985e153 < x < 4.9000000000000003e91

    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. Taylor expanded in x around 0 98.3%

      \[\leadsto \color{blue}{\left(\left(b - 0.5\right) \cdot \log c + \left(a + \left(t + z\right)\right)\right)} + y \cdot i \]
    3. Taylor expanded in t around 0 81.3%

      \[\leadsto \color{blue}{\left(a + \left(\log c \cdot \left(b - 0.5\right) + z\right)\right)} + y \cdot i \]
  3. Recombined 2 regimes into one program.
  4. Final simplification80.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.8 \cdot 10^{+153} \lor \neg \left(x \leq 4.9 \cdot 10^{+91}\right):\\ \;\;\;\;y \cdot i + \left(x \cdot \log y + \left(z + t\right)\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot i + \left(a + \left(z + \log c \cdot \left(b - 0.5\right)\right)\right)\\ \end{array} \]

Alternative 12: 94.6% accurate, 1.9× speedup?

\[\begin{array}{l} [z, t, a] = \mathsf{sort}([z, t, a])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -9.5 \cdot 10^{+153} \lor \neg \left(x \leq 9 \cdot 10^{+60}\right):\\ \;\;\;\;y \cdot i + \left(x \cdot \log y + \left(a + \left(z + t\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot i + \left(a + \left(z + \log c \cdot \left(b - 0.5\right)\right)\right)\\ \end{array} \end{array} \]
NOTE: z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i)
 :precision binary64
 (if (or (<= x -9.5e+153) (not (<= x 9e+60)))
   (+ (* y i) (+ (* x (log y)) (+ a (+ z t))))
   (+ (* y i) (+ a (+ z (* (log c) (- b 0.5)))))))
assert(z < t && t < a);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if ((x <= -9.5e+153) || !(x <= 9e+60)) {
		tmp = (y * i) + ((x * log(y)) + (a + (z + t)));
	} else {
		tmp = (y * i) + (a + (z + (log(c) * (b - 0.5))));
	}
	return tmp;
}
NOTE: z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b, c, i)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: i
    real(8) :: tmp
    if ((x <= (-9.5d+153)) .or. (.not. (x <= 9d+60))) then
        tmp = (y * i) + ((x * log(y)) + (a + (z + t)))
    else
        tmp = (y * i) + (a + (z + (log(c) * (b - 0.5d0))))
    end if
    code = tmp
end function
assert z < t && t < a;
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if ((x <= -9.5e+153) || !(x <= 9e+60)) {
		tmp = (y * i) + ((x * Math.log(y)) + (a + (z + t)));
	} else {
		tmp = (y * i) + (a + (z + (Math.log(c) * (b - 0.5))));
	}
	return tmp;
}
[z, t, a] = sort([z, t, a])
def code(x, y, z, t, a, b, c, i):
	tmp = 0
	if (x <= -9.5e+153) or not (x <= 9e+60):
		tmp = (y * i) + ((x * math.log(y)) + (a + (z + t)))
	else:
		tmp = (y * i) + (a + (z + (math.log(c) * (b - 0.5))))
	return tmp
z, t, a = sort([z, t, a])
function code(x, y, z, t, a, b, c, i)
	tmp = 0.0
	if ((x <= -9.5e+153) || !(x <= 9e+60))
		tmp = Float64(Float64(y * i) + Float64(Float64(x * log(y)) + Float64(a + Float64(z + t))));
	else
		tmp = Float64(Float64(y * i) + Float64(a + Float64(z + Float64(log(c) * Float64(b - 0.5)))));
	end
	return tmp
end
z, t, a = num2cell(sort([z, t, a])){:}
function tmp_2 = code(x, y, z, t, a, b, c, i)
	tmp = 0.0;
	if ((x <= -9.5e+153) || ~((x <= 9e+60)))
		tmp = (y * i) + ((x * log(y)) + (a + (z + t)));
	else
		tmp = (y * i) + (a + (z + (log(c) * (b - 0.5))));
	end
	tmp_2 = tmp;
end
NOTE: z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[x, -9.5e+153], N[Not[LessEqual[x, 9e+60]], $MachinePrecision]], N[(N[(y * i), $MachinePrecision] + N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(a + N[(z + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * i), $MachinePrecision] + N[(a + N[(z + N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[z, t, a] = \mathsf{sort}([z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9.5 \cdot 10^{+153} \lor \neg \left(x \leq 9 \cdot 10^{+60}\right):\\
\;\;\;\;y \cdot i + \left(x \cdot \log y + \left(a + \left(z + t\right)\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -9.4999999999999995e153 or 9.00000000000000026e60 < x

    1. Initial program 99.7%

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

      \[\leadsto \left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \color{blue}{\log c \cdot b}\right) + y \cdot i \]
    3. Taylor expanded in b around 0 87.4%

      \[\leadsto \color{blue}{\left(\log y \cdot x + \left(a + \left(t + z\right)\right)\right)} + y \cdot i \]

    if -9.4999999999999995e153 < x < 9.00000000000000026e60

    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. Taylor expanded in x around 0 98.3%

      \[\leadsto \color{blue}{\left(\left(b - 0.5\right) \cdot \log c + \left(a + \left(t + z\right)\right)\right)} + y \cdot i \]
    3. Taylor expanded in t around 0 81.3%

      \[\leadsto \color{blue}{\left(a + \left(\log c \cdot \left(b - 0.5\right) + z\right)\right)} + y \cdot i \]
  3. Recombined 2 regimes into one program.
  4. Final simplification83.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -9.5 \cdot 10^{+153} \lor \neg \left(x \leq 9 \cdot 10^{+60}\right):\\ \;\;\;\;y \cdot i + \left(x \cdot \log y + \left(a + \left(z + t\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot i + \left(a + \left(z + \log c \cdot \left(b - 0.5\right)\right)\right)\\ \end{array} \]

Alternative 13: 60.2% accurate, 2.0× speedup?

\[\begin{array}{l} [z, t, a] = \mathsf{sort}([z, t, a])\\ \\ \begin{array}{l} \mathbf{if}\;z \leq -1.05 \cdot 10^{+142}:\\ \;\;\;\;z + y \cdot i\\ \mathbf{elif}\;z \leq -5.4 \cdot 10^{-108}:\\ \;\;\;\;y \cdot i + b \cdot \log c\\ \mathbf{else}:\\ \;\;\;\;a + y \cdot i\\ \end{array} \end{array} \]
NOTE: z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i)
 :precision binary64
 (if (<= z -1.05e+142)
   (+ z (* y i))
   (if (<= z -5.4e-108) (+ (* y i) (* b (log c))) (+ a (* y i)))))
assert(z < t && t < a);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if (z <= -1.05e+142) {
		tmp = z + (y * i);
	} else if (z <= -5.4e-108) {
		tmp = (y * i) + (b * log(c));
	} else {
		tmp = a + (y * i);
	}
	return tmp;
}
NOTE: z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b, c, i)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: i
    real(8) :: tmp
    if (z <= (-1.05d+142)) then
        tmp = z + (y * i)
    else if (z <= (-5.4d-108)) then
        tmp = (y * i) + (b * log(c))
    else
        tmp = a + (y * i)
    end if
    code = tmp
end function
assert z < t && t < a;
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if (z <= -1.05e+142) {
		tmp = z + (y * i);
	} else if (z <= -5.4e-108) {
		tmp = (y * i) + (b * Math.log(c));
	} else {
		tmp = a + (y * i);
	}
	return tmp;
}
[z, t, a] = sort([z, t, a])
def code(x, y, z, t, a, b, c, i):
	tmp = 0
	if z <= -1.05e+142:
		tmp = z + (y * i)
	elif z <= -5.4e-108:
		tmp = (y * i) + (b * math.log(c))
	else:
		tmp = a + (y * i)
	return tmp
z, t, a = sort([z, t, a])
function code(x, y, z, t, a, b, c, i)
	tmp = 0.0
	if (z <= -1.05e+142)
		tmp = Float64(z + Float64(y * i));
	elseif (z <= -5.4e-108)
		tmp = Float64(Float64(y * i) + Float64(b * log(c)));
	else
		tmp = Float64(a + Float64(y * i));
	end
	return tmp
end
z, t, a = num2cell(sort([z, t, a])){:}
function tmp_2 = code(x, y, z, t, a, b, c, i)
	tmp = 0.0;
	if (z <= -1.05e+142)
		tmp = z + (y * i);
	elseif (z <= -5.4e-108)
		tmp = (y * i) + (b * log(c));
	else
		tmp = a + (y * i);
	end
	tmp_2 = tmp;
end
NOTE: z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[z, -1.05e+142], N[(z + N[(y * i), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -5.4e-108], N[(N[(y * i), $MachinePrecision] + N[(b * N[Log[c], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(y * i), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[z, t, a] = \mathsf{sort}([z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.05 \cdot 10^{+142}:\\
\;\;\;\;z + y \cdot i\\

\mathbf{elif}\;z \leq -5.4 \cdot 10^{-108}:\\
\;\;\;\;y \cdot i + b \cdot \log c\\

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


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

    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. Taylor expanded in z around inf 66.7%

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

    if -1.05e142 < z < -5.4000000000000001e-108

    1. Initial program 99.7%

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

      \[\leadsto \color{blue}{\left(\left(b - 0.5\right) \cdot \log c + \left(a + \left(t + z\right)\right)\right)} + y \cdot i \]
    3. Taylor expanded in b around inf 51.8%

      \[\leadsto \color{blue}{\log c \cdot b} + y \cdot i \]

    if -5.4000000000000001e-108 < z

    1. Initial program 99.8%

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

      \[\leadsto \color{blue}{a} + y \cdot i \]
  3. Recombined 3 regimes into one program.
  4. Final simplification47.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.05 \cdot 10^{+142}:\\ \;\;\;\;z + y \cdot i\\ \mathbf{elif}\;z \leq -5.4 \cdot 10^{-108}:\\ \;\;\;\;y \cdot i + b \cdot \log c\\ \mathbf{else}:\\ \;\;\;\;a + y \cdot i\\ \end{array} \]

Alternative 14: 38.4% accurate, 16.5× speedup?

\[\begin{array}{l} [z, t, a] = \mathsf{sort}([z, t, a])\\ \\ \begin{array}{l} \mathbf{if}\;z \leq -1.9 \cdot 10^{+166}:\\ \;\;\;\;z\\ \mathbf{elif}\;z \leq -7.2 \cdot 10^{+26}:\\ \;\;\;\;y \cdot i\\ \mathbf{elif}\;z \leq -8.2 \cdot 10^{-37}:\\ \;\;\;\;a\\ \mathbf{elif}\;z \leq 8.2 \cdot 10^{-264}:\\ \;\;\;\;y \cdot i\\ \mathbf{elif}\;z \leq 7 \cdot 10^{-7}:\\ \;\;\;\;a\\ \mathbf{else}:\\ \;\;\;\;y \cdot i\\ \end{array} \end{array} \]
NOTE: z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i)
 :precision binary64
 (if (<= z -1.9e+166)
   z
   (if (<= z -7.2e+26)
     (* y i)
     (if (<= z -8.2e-37)
       a
       (if (<= z 8.2e-264) (* y i) (if (<= z 7e-7) a (* y i)))))))
assert(z < t && t < a);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if (z <= -1.9e+166) {
		tmp = z;
	} else if (z <= -7.2e+26) {
		tmp = y * i;
	} else if (z <= -8.2e-37) {
		tmp = a;
	} else if (z <= 8.2e-264) {
		tmp = y * i;
	} else if (z <= 7e-7) {
		tmp = a;
	} else {
		tmp = y * i;
	}
	return tmp;
}
NOTE: z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b, c, i)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: i
    real(8) :: tmp
    if (z <= (-1.9d+166)) then
        tmp = z
    else if (z <= (-7.2d+26)) then
        tmp = y * i
    else if (z <= (-8.2d-37)) then
        tmp = a
    else if (z <= 8.2d-264) then
        tmp = y * i
    else if (z <= 7d-7) then
        tmp = a
    else
        tmp = y * i
    end if
    code = tmp
end function
assert z < t && t < a;
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if (z <= -1.9e+166) {
		tmp = z;
	} else if (z <= -7.2e+26) {
		tmp = y * i;
	} else if (z <= -8.2e-37) {
		tmp = a;
	} else if (z <= 8.2e-264) {
		tmp = y * i;
	} else if (z <= 7e-7) {
		tmp = a;
	} else {
		tmp = y * i;
	}
	return tmp;
}
[z, t, a] = sort([z, t, a])
def code(x, y, z, t, a, b, c, i):
	tmp = 0
	if z <= -1.9e+166:
		tmp = z
	elif z <= -7.2e+26:
		tmp = y * i
	elif z <= -8.2e-37:
		tmp = a
	elif z <= 8.2e-264:
		tmp = y * i
	elif z <= 7e-7:
		tmp = a
	else:
		tmp = y * i
	return tmp
z, t, a = sort([z, t, a])
function code(x, y, z, t, a, b, c, i)
	tmp = 0.0
	if (z <= -1.9e+166)
		tmp = z;
	elseif (z <= -7.2e+26)
		tmp = Float64(y * i);
	elseif (z <= -8.2e-37)
		tmp = a;
	elseif (z <= 8.2e-264)
		tmp = Float64(y * i);
	elseif (z <= 7e-7)
		tmp = a;
	else
		tmp = Float64(y * i);
	end
	return tmp
end
z, t, a = num2cell(sort([z, t, a])){:}
function tmp_2 = code(x, y, z, t, a, b, c, i)
	tmp = 0.0;
	if (z <= -1.9e+166)
		tmp = z;
	elseif (z <= -7.2e+26)
		tmp = y * i;
	elseif (z <= -8.2e-37)
		tmp = a;
	elseif (z <= 8.2e-264)
		tmp = y * i;
	elseif (z <= 7e-7)
		tmp = a;
	else
		tmp = y * i;
	end
	tmp_2 = tmp;
end
NOTE: z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[z, -1.9e+166], z, If[LessEqual[z, -7.2e+26], N[(y * i), $MachinePrecision], If[LessEqual[z, -8.2e-37], a, If[LessEqual[z, 8.2e-264], N[(y * i), $MachinePrecision], If[LessEqual[z, 7e-7], a, N[(y * i), $MachinePrecision]]]]]]
\begin{array}{l}
[z, t, a] = \mathsf{sort}([z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.9 \cdot 10^{+166}:\\
\;\;\;\;z\\

\mathbf{elif}\;z \leq -7.2 \cdot 10^{+26}:\\
\;\;\;\;y \cdot i\\

\mathbf{elif}\;z \leq -8.2 \cdot 10^{-37}:\\
\;\;\;\;a\\

\mathbf{elif}\;z \leq 8.2 \cdot 10^{-264}:\\
\;\;\;\;y \cdot i\\

\mathbf{elif}\;z \leq 7 \cdot 10^{-7}:\\
\;\;\;\;a\\

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


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

    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. Taylor expanded in z around inf 72.9%

      \[\leadsto \color{blue}{z} + y \cdot i \]
    3. Taylor expanded in z around inf 62.0%

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

    if -1.90000000000000003e166 < z < -7.20000000000000048e26 or -8.1999999999999996e-37 < z < 8.20000000000000045e-264 or 6.99999999999999968e-7 < z

    1. Initial program 99.8%

      \[\left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \left(b - 0.5\right) \cdot \log c\right) + y \cdot i \]
    2. Step-by-step derivation
      1. associate-+l+99.8%

        \[\leadsto \color{blue}{\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \left(\left(b - 0.5\right) \cdot \log c + y \cdot i\right)} \]
      2. associate-+l+99.8%

        \[\leadsto \color{blue}{\left(\left(x \cdot \log y + z\right) + \left(t + a\right)\right)} + \left(\left(b - 0.5\right) \cdot \log c + y \cdot i\right) \]
      3. fma-def99.8%

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

        \[\leadsto \left(\mathsf{fma}\left(x, \log y, z\right) + \left(t + a\right)\right) + \left(\color{blue}{\left(b + \left(-0.5\right)\right)} \cdot \log c + y \cdot i\right) \]
      5. metadata-eval99.8%

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

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

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

        \[\leadsto \color{blue}{y \cdot i} \]
    6. Simplified24.1%

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

    if -7.20000000000000048e26 < z < -8.1999999999999996e-37 or 8.20000000000000045e-264 < z < 6.99999999999999968e-7

    1. Initial program 99.8%

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

      \[\leadsto \color{blue}{a} + y \cdot i \]
    3. Taylor expanded in a around inf 16.3%

      \[\leadsto \color{blue}{a} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification27.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.9 \cdot 10^{+166}:\\ \;\;\;\;z\\ \mathbf{elif}\;z \leq -7.2 \cdot 10^{+26}:\\ \;\;\;\;y \cdot i\\ \mathbf{elif}\;z \leq -8.2 \cdot 10^{-37}:\\ \;\;\;\;a\\ \mathbf{elif}\;z \leq 8.2 \cdot 10^{-264}:\\ \;\;\;\;y \cdot i\\ \mathbf{elif}\;z \leq 7 \cdot 10^{-7}:\\ \;\;\;\;a\\ \mathbf{else}:\\ \;\;\;\;y \cdot i\\ \end{array} \]

Alternative 15: 55.7% accurate, 31.0× speedup?

\[\begin{array}{l} [z, t, a] = \mathsf{sort}([z, t, a])\\ \\ \begin{array}{l} \mathbf{if}\;z \leq -2.2 \cdot 10^{+166}:\\ \;\;\;\;z\\ \mathbf{else}:\\ \;\;\;\;a + y \cdot i\\ \end{array} \end{array} \]
NOTE: z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i)
 :precision binary64
 (if (<= z -2.2e+166) z (+ a (* y i))))
assert(z < t && t < a);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if (z <= -2.2e+166) {
		tmp = z;
	} else {
		tmp = a + (y * i);
	}
	return tmp;
}
NOTE: z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b, c, i)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: i
    real(8) :: tmp
    if (z <= (-2.2d+166)) then
        tmp = z
    else
        tmp = a + (y * i)
    end if
    code = tmp
end function
assert z < t && t < a;
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if (z <= -2.2e+166) {
		tmp = z;
	} else {
		tmp = a + (y * i);
	}
	return tmp;
}
[z, t, a] = sort([z, t, a])
def code(x, y, z, t, a, b, c, i):
	tmp = 0
	if z <= -2.2e+166:
		tmp = z
	else:
		tmp = a + (y * i)
	return tmp
z, t, a = sort([z, t, a])
function code(x, y, z, t, a, b, c, i)
	tmp = 0.0
	if (z <= -2.2e+166)
		tmp = z;
	else
		tmp = Float64(a + Float64(y * i));
	end
	return tmp
end
z, t, a = num2cell(sort([z, t, a])){:}
function tmp_2 = code(x, y, z, t, a, b, c, i)
	tmp = 0.0;
	if (z <= -2.2e+166)
		tmp = z;
	else
		tmp = a + (y * i);
	end
	tmp_2 = tmp;
end
NOTE: z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[z, -2.2e+166], z, N[(a + N[(y * i), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[z, t, a] = \mathsf{sort}([z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.2 \cdot 10^{+166}:\\
\;\;\;\;z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -2.1999999999999999e166

    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. Taylor expanded in z around inf 72.9%

      \[\leadsto \color{blue}{z} + y \cdot i \]
    3. Taylor expanded in z around inf 62.0%

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

    if -2.1999999999999999e166 < z

    1. Initial program 99.8%

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

      \[\leadsto \color{blue}{a} + y \cdot i \]
  3. Recombined 2 regimes into one program.
  4. Final simplification43.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.2 \cdot 10^{+166}:\\ \;\;\;\;z\\ \mathbf{else}:\\ \;\;\;\;a + y \cdot i\\ \end{array} \]

Alternative 16: 60.9% accurate, 31.0× speedup?

\[\begin{array}{l} [z, t, a] = \mathsf{sort}([z, t, a])\\ \\ \begin{array}{l} \mathbf{if}\;z \leq -1.5 \cdot 10^{+74}:\\ \;\;\;\;z + y \cdot i\\ \mathbf{else}:\\ \;\;\;\;a + y \cdot i\\ \end{array} \end{array} \]
NOTE: z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i)
 :precision binary64
 (if (<= z -1.5e+74) (+ z (* y i)) (+ a (* y i))))
assert(z < t && t < a);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if (z <= -1.5e+74) {
		tmp = z + (y * i);
	} else {
		tmp = a + (y * i);
	}
	return tmp;
}
NOTE: z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b, c, i)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: i
    real(8) :: tmp
    if (z <= (-1.5d+74)) then
        tmp = z + (y * i)
    else
        tmp = a + (y * i)
    end if
    code = tmp
end function
assert z < t && t < a;
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if (z <= -1.5e+74) {
		tmp = z + (y * i);
	} else {
		tmp = a + (y * i);
	}
	return tmp;
}
[z, t, a] = sort([z, t, a])
def code(x, y, z, t, a, b, c, i):
	tmp = 0
	if z <= -1.5e+74:
		tmp = z + (y * i)
	else:
		tmp = a + (y * i)
	return tmp
z, t, a = sort([z, t, a])
function code(x, y, z, t, a, b, c, i)
	tmp = 0.0
	if (z <= -1.5e+74)
		tmp = Float64(z + Float64(y * i));
	else
		tmp = Float64(a + Float64(y * i));
	end
	return tmp
end
z, t, a = num2cell(sort([z, t, a])){:}
function tmp_2 = code(x, y, z, t, a, b, c, i)
	tmp = 0.0;
	if (z <= -1.5e+74)
		tmp = z + (y * i);
	else
		tmp = a + (y * i);
	end
	tmp_2 = tmp;
end
NOTE: z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[z, -1.5e+74], N[(z + N[(y * i), $MachinePrecision]), $MachinePrecision], N[(a + N[(y * i), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[z, t, a] = \mathsf{sort}([z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.5 \cdot 10^{+74}:\\
\;\;\;\;z + y \cdot i\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.5e74

    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. Taylor expanded in z around inf 58.1%

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

    if -1.5e74 < z

    1. Initial program 99.8%

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

      \[\leadsto \color{blue}{a} + y \cdot i \]
  3. Recombined 2 regimes into one program.
  4. Final simplification45.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.5 \cdot 10^{+74}:\\ \;\;\;\;z + y \cdot i\\ \mathbf{else}:\\ \;\;\;\;a + y \cdot i\\ \end{array} \]

Alternative 17: 37.4% accurate, 71.5× speedup?

\[\begin{array}{l} [z, t, a] = \mathsf{sort}([z, t, a])\\ \\ \begin{array}{l} \mathbf{if}\;z \leq -1.45 \cdot 10^{+74}:\\ \;\;\;\;z\\ \mathbf{else}:\\ \;\;\;\;a\\ \end{array} \end{array} \]
NOTE: z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i) :precision binary64 (if (<= z -1.45e+74) z a))
assert(z < t && t < a);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if (z <= -1.45e+74) {
		tmp = z;
	} else {
		tmp = a;
	}
	return tmp;
}
NOTE: z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b, c, i)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: i
    real(8) :: tmp
    if (z <= (-1.45d+74)) then
        tmp = z
    else
        tmp = a
    end if
    code = tmp
end function
assert z < t && t < a;
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if (z <= -1.45e+74) {
		tmp = z;
	} else {
		tmp = a;
	}
	return tmp;
}
[z, t, a] = sort([z, t, a])
def code(x, y, z, t, a, b, c, i):
	tmp = 0
	if z <= -1.45e+74:
		tmp = z
	else:
		tmp = a
	return tmp
z, t, a = sort([z, t, a])
function code(x, y, z, t, a, b, c, i)
	tmp = 0.0
	if (z <= -1.45e+74)
		tmp = z;
	else
		tmp = a;
	end
	return tmp
end
z, t, a = num2cell(sort([z, t, a])){:}
function tmp_2 = code(x, y, z, t, a, b, c, i)
	tmp = 0.0;
	if (z <= -1.45e+74)
		tmp = z;
	else
		tmp = a;
	end
	tmp_2 = tmp;
end
NOTE: z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[z, -1.45e+74], z, a]
\begin{array}{l}
[z, t, a] = \mathsf{sort}([z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.45 \cdot 10^{+74}:\\
\;\;\;\;z\\

\mathbf{else}:\\
\;\;\;\;a\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.4500000000000001e74

    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. Taylor expanded in z around inf 58.1%

      \[\leadsto \color{blue}{z} + y \cdot i \]
    3. Taylor expanded in z around inf 45.8%

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

    if -1.4500000000000001e74 < z

    1. Initial program 99.8%

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

      \[\leadsto \color{blue}{a} + y \cdot i \]
    3. Taylor expanded in a around inf 15.9%

      \[\leadsto \color{blue}{a} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification22.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.45 \cdot 10^{+74}:\\ \;\;\;\;z\\ \mathbf{else}:\\ \;\;\;\;a\\ \end{array} \]

Alternative 18: 22.7% accurate, 219.0× speedup?

\[\begin{array}{l} [z, t, a] = \mathsf{sort}([z, t, a])\\ \\ a \end{array} \]
NOTE: z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i) :precision binary64 a)
assert(z < t && t < a);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	return a;
}
NOTE: z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b, c, i)
    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 = a
end function
assert z < t && t < a;
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	return a;
}
[z, t, a] = sort([z, t, a])
def code(x, y, z, t, a, b, c, i):
	return a
z, t, a = sort([z, t, a])
function code(x, y, z, t, a, b, c, i)
	return a
end
z, t, a = num2cell(sort([z, t, a])){:}
function tmp = code(x, y, z, t, a, b, c, i)
	tmp = a;
end
NOTE: z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_, i_] := a
\begin{array}{l}
[z, t, a] = \mathsf{sort}([z, t, a])\\
\\
a
\end{array}
Derivation
  1. Initial program 99.8%

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

    \[\leadsto \color{blue}{a} + y \cdot i \]
  3. Taylor expanded in a around inf 14.7%

    \[\leadsto \color{blue}{a} \]
  4. Final simplification14.7%

    \[\leadsto a \]

Reproduce

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