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

Percentage Accurate: 99.8% → 99.8%
Time: 14.8s
Alternatives: 13
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ \left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \left(b - 0.5\right) \cdot \log c\right) + y \cdot i \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (+ (+ (+ (+ (+ (* x (log y)) z) t) a) (* (- b 0.5) (log c))) (* y i)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	return (((((x * log(y)) + z) + t) + a) + ((b - 0.5) * log(c))) + (y * i);
}
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 13 alternatives:

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

Initial Program: 99.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \left(b - 0.5\right) \cdot \log c\right) + y \cdot i \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (+ (+ (+ (+ (+ (* x (log y)) z) t) a) (* (- b 0.5) (log c))) (* y i)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	return (((((x * log(y)) + z) + t) + a) + ((b - 0.5) * log(c))) + (y * i);
}
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.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(\left(\left(\left(z - \log \left(\frac{1}{y}\right) \cdot x\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
 (+ (+ (+ (+ (- z (* (log (/ 1.0 y)) x)) 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 ((((z - (log((1.0 / y)) * x)) + 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 = ((((z - (log((1.0d0 / y)) * x)) + 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 ((((z - (Math.log((1.0 / y)) * x)) + t) + a) + ((b - 0.5) * Math.log(c))) + (y * i);
}
def code(x, y, z, t, a, b, c, i):
	return ((((z - (math.log((1.0 / y)) * x)) + 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(z - Float64(log(Float64(1.0 / y)) * x)) + 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 = ((((z - (log((1.0 / y)) * x)) + t) + a) + ((b - 0.5) * log(c))) + (y * i);
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(N[(N[(N[(N[(z - N[(N[Log[N[(1.0 / y), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision]), $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(z - \log \left(\frac{1}{y}\right) \cdot x\right) + t\right) + a\right) + \left(b - 0.5\right) \cdot \log c\right) + y \cdot i
\end{array}
Derivation
  1. Initial program 99.8%

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

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

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

Alternative 2: 99.8% accurate, 1.0× speedup?

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

\\
y \cdot i + \left(\left(b - 0.5\right) \cdot \log c + \left(a + \left(t + \left(z + x \cdot \log y\right)\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. Final simplification99.8%

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

Alternative 3: 89.8% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_1 := \left(b - 0.5\right) \cdot \log c\\
\mathbf{if}\;x \leq -2.5 \cdot 10^{+239}:\\
\;\;\;\;y \cdot i - \log \left(\frac{1}{y}\right) \cdot x\\

\mathbf{elif}\;x \leq 3 \cdot 10^{+144}:\\
\;\;\;\;y \cdot i + \left(t_1 + \left(a + \left(z + t\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;t + \left(t_1 + \left(a + x \cdot \log y\right)\right)\\


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

    1. Initial program 99.2%

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(\log \left(\frac{1}{y}\right) \cdot x\right)} + y \cdot i \]

    if -2.50000000000000003e239 < x < 2.9999999999999999e144

    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 93.0%

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

    if 2.9999999999999999e144 < 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. Step-by-step derivation
      1. associate-+l+99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.5 \cdot 10^{+239}:\\ \;\;\;\;y \cdot i - \log \left(\frac{1}{y}\right) \cdot x\\ \mathbf{elif}\;x \leq 3 \cdot 10^{+144}:\\ \;\;\;\;y \cdot i + \left(\left(b - 0.5\right) \cdot \log c + \left(a + \left(z + t\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t + \left(\left(b - 0.5\right) \cdot \log c + \left(a + x \cdot \log y\right)\right)\\ \end{array} \]

Alternative 4: 90.8% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_1 := \left(b - 0.5\right) \cdot \log c\\
\mathbf{if}\;y \leq 9 \cdot 10^{-49}:\\
\;\;\;\;t + \left(t_1 + \left(a + \left(z + x \cdot \log y\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;y \cdot i + \left(t_1 + \left(a + \left(z + t\right)\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 9.0000000000000004e-49

    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. Step-by-step derivation
      1. associate-+l+99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 9.0000000000000004e-49 < y

    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 89.1%

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

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

Alternative 5: 44.1% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
t_1 := y \cdot i + b \cdot \log c\\
t_2 := z + y \cdot i\\
\mathbf{if}\;a \leq 5.5 \cdot 10^{-177}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;a \leq 1.6 \cdot 10^{-73}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;a \leq 2.85 \cdot 10^{-66}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;a \leq 8 \cdot 10^{+32}:\\
\;\;\;\;y \cdot i + x \cdot \log y\\

\mathbf{elif}\;a \leq 5.8 \cdot 10^{+56}:\\
\;\;\;\;t + \left(\log c \cdot -0.5 + \left(z + a\right)\right)\\

\mathbf{elif}\;a \leq 8.2 \cdot 10^{+126}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if a < 5.4999999999999996e-177 or 1.59999999999999993e-73 < a < 2.84999999999999981e-66

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

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

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

    if 5.4999999999999996e-177 < a < 1.59999999999999993e-73 or 5.80000000000000014e56 < a < 8.2000000000000001e126

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

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

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

    if 2.84999999999999981e-66 < a < 8.00000000000000043e32

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(\log \left(\frac{1}{y}\right) \cdot x\right)} + y \cdot i \]
    4. Step-by-step derivation
      1. mul-1-neg56.2%

        \[\leadsto \color{blue}{\left(-\log \left(\frac{1}{y}\right) \cdot x\right)} + y \cdot i \]
      2. log-rec56.2%

        \[\leadsto \left(-\color{blue}{\left(-\log y\right)} \cdot x\right) + y \cdot i \]
      3. distribute-lft-neg-out56.2%

        \[\leadsto \left(-\color{blue}{\left(-\log y \cdot x\right)}\right) + y \cdot i \]
      4. remove-double-neg56.2%

        \[\leadsto \color{blue}{\log y \cdot x} + y \cdot i \]
    5. Simplified56.2%

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

    if 8.00000000000000043e32 < a < 5.80000000000000014e56

    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. Step-by-step derivation
      1. associate-+l+100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 8.2000000000000001e126 < 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. Step-by-step derivation
      1. associate-+l+99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto t + \mathsf{fma}\left(y, i, \color{blue}{a}\right) \]
  3. Recombined 5 regimes into one program.
  4. Final simplification51.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq 5.5 \cdot 10^{-177}:\\ \;\;\;\;z + y \cdot i\\ \mathbf{elif}\;a \leq 1.6 \cdot 10^{-73}:\\ \;\;\;\;y \cdot i + b \cdot \log c\\ \mathbf{elif}\;a \leq 2.85 \cdot 10^{-66}:\\ \;\;\;\;z + y \cdot i\\ \mathbf{elif}\;a \leq 8 \cdot 10^{+32}:\\ \;\;\;\;y \cdot i + x \cdot \log y\\ \mathbf{elif}\;a \leq 5.8 \cdot 10^{+56}:\\ \;\;\;\;t + \left(\log c \cdot -0.5 + \left(z + a\right)\right)\\ \mathbf{elif}\;a \leq 8.2 \cdot 10^{+126}:\\ \;\;\;\;y \cdot i + b \cdot \log c\\ \mathbf{else}:\\ \;\;\;\;t + \mathsf{fma}\left(y, i, a\right)\\ \end{array} \]

Alternative 6: 88.8% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.5 \cdot 10^{+241}:\\
\;\;\;\;y \cdot i - \log \left(\frac{1}{y}\right) \cdot x\\

\mathbf{elif}\;x \leq 2.7 \cdot 10^{+144}:\\
\;\;\;\;y \cdot i + \left(\left(b - 0.5\right) \cdot \log c + \left(a + \left(z + t\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;y \cdot i + x \cdot \log y\\


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

    1. Initial program 99.2%

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(\log \left(\frac{1}{y}\right) \cdot x\right)} + y \cdot i \]

    if -6.4999999999999994e241 < x < 2.70000000000000015e144

    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 93.0%

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

    if 2.70000000000000015e144 < 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 y around inf 99.8%

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

      \[\leadsto \color{blue}{-1 \cdot \left(\log \left(\frac{1}{y}\right) \cdot x\right)} + y \cdot i \]
    4. Step-by-step derivation
      1. mul-1-neg74.9%

        \[\leadsto \color{blue}{\left(-\log \left(\frac{1}{y}\right) \cdot x\right)} + y \cdot i \]
      2. log-rec74.9%

        \[\leadsto \left(-\color{blue}{\left(-\log y\right)} \cdot x\right) + y \cdot i \]
      3. distribute-lft-neg-out74.9%

        \[\leadsto \left(-\color{blue}{\left(-\log y \cdot x\right)}\right) + y \cdot i \]
      4. remove-double-neg74.9%

        \[\leadsto \color{blue}{\log y \cdot x} + y \cdot i \]
    5. Simplified74.9%

      \[\leadsto \color{blue}{\log y \cdot x} + y \cdot i \]
  3. Recombined 3 regimes into one program.
  4. Final simplification90.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -6.5 \cdot 10^{+241}:\\ \;\;\;\;y \cdot i - \log \left(\frac{1}{y}\right) \cdot x\\ \mathbf{elif}\;x \leq 2.7 \cdot 10^{+144}:\\ \;\;\;\;y \cdot i + \left(\left(b - 0.5\right) \cdot \log c + \left(a + \left(z + t\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot i + x \cdot \log y\\ \end{array} \]

Alternative 7: 70.6% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 7.5 \cdot 10^{+60}:\\
\;\;\;\;a + \left(\left(b - 0.5\right) \cdot \log c + \left(z + t\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 7.5e60

    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 79.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. Step-by-step derivation
      1. associate-+r+79.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 7.5e60 < y

    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. Step-by-step derivation
      1. associate-+l+99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto t + \mathsf{fma}\left(y, i, \color{blue}{a}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification70.3%

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

Alternative 8: 55.7% accurate, 2.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.15 \cdot 10^{+201}:\\
\;\;\;\;z + y \cdot i\\

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


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

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

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

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

    if -1.1500000000000001e201 < 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) + \left(a + \left(b - 0.5\right) \cdot \log c\right)\right)} + y \cdot i \]
      2. +-commutative99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto t + \mathsf{fma}\left(y, i, \color{blue}{a}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification57.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.15 \cdot 10^{+201}:\\ \;\;\;\;z + y \cdot i\\ \mathbf{else}:\\ \;\;\;\;t + \mathsf{fma}\left(y, i, a\right)\\ \end{array} \]

Alternative 9: 33.6% accurate, 19.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq 1.8 \cdot 10^{-144}:\\ \;\;\;\;z + t\\ \mathbf{elif}\;a \leq 8.5 \cdot 10^{-7}:\\ \;\;\;\;y \cdot i\\ \mathbf{elif}\;a \leq 7.4 \cdot 10^{+55}:\\ \;\;\;\;z + t\\ \mathbf{elif}\;a \leq 2.1 \cdot 10^{+140}:\\ \;\;\;\;y \cdot i\\ \mathbf{else}:\\ \;\;\;\;t + a\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (if (<= a 1.8e-144)
   (+ z t)
   (if (<= a 8.5e-7)
     (* y i)
     (if (<= a 7.4e+55) (+ z t) (if (<= a 2.1e+140) (* y i) (+ t a))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if (a <= 1.8e-144) {
		tmp = z + t;
	} else if (a <= 8.5e-7) {
		tmp = y * i;
	} else if (a <= 7.4e+55) {
		tmp = z + t;
	} else if (a <= 2.1e+140) {
		tmp = y * i;
	} else {
		tmp = t + a;
	}
	return tmp;
}
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 (a <= 1.8d-144) then
        tmp = z + t
    else if (a <= 8.5d-7) then
        tmp = y * i
    else if (a <= 7.4d+55) then
        tmp = z + t
    else if (a <= 2.1d+140) then
        tmp = y * i
    else
        tmp = t + a
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if (a <= 1.8e-144) {
		tmp = z + t;
	} else if (a <= 8.5e-7) {
		tmp = y * i;
	} else if (a <= 7.4e+55) {
		tmp = z + t;
	} else if (a <= 2.1e+140) {
		tmp = y * i;
	} else {
		tmp = t + a;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	tmp = 0
	if a <= 1.8e-144:
		tmp = z + t
	elif a <= 8.5e-7:
		tmp = y * i
	elif a <= 7.4e+55:
		tmp = z + t
	elif a <= 2.1e+140:
		tmp = y * i
	else:
		tmp = t + a
	return tmp
function code(x, y, z, t, a, b, c, i)
	tmp = 0.0
	if (a <= 1.8e-144)
		tmp = Float64(z + t);
	elseif (a <= 8.5e-7)
		tmp = Float64(y * i);
	elseif (a <= 7.4e+55)
		tmp = Float64(z + t);
	elseif (a <= 2.1e+140)
		tmp = Float64(y * i);
	else
		tmp = Float64(t + a);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	tmp = 0.0;
	if (a <= 1.8e-144)
		tmp = z + t;
	elseif (a <= 8.5e-7)
		tmp = y * i;
	elseif (a <= 7.4e+55)
		tmp = z + t;
	elseif (a <= 2.1e+140)
		tmp = y * i;
	else
		tmp = t + a;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[a, 1.8e-144], N[(z + t), $MachinePrecision], If[LessEqual[a, 8.5e-7], N[(y * i), $MachinePrecision], If[LessEqual[a, 7.4e+55], N[(z + t), $MachinePrecision], If[LessEqual[a, 2.1e+140], N[(y * i), $MachinePrecision], N[(t + a), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \leq 1.8 \cdot 10^{-144}:\\
\;\;\;\;z + t\\

\mathbf{elif}\;a \leq 8.5 \cdot 10^{-7}:\\
\;\;\;\;y \cdot i\\

\mathbf{elif}\;a \leq 7.4 \cdot 10^{+55}:\\
\;\;\;\;z + t\\

\mathbf{elif}\;a \leq 2.1 \cdot 10^{+140}:\\
\;\;\;\;y \cdot i\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if a < 1.8e-144 or 8.50000000000000014e-7 < a < 7.4000000000000004e55

    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) + \left(a + \left(b - 0.5\right) \cdot \log c\right)\right)} + y \cdot i \]
      2. +-commutative99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.8e-144 < a < 8.50000000000000014e-7 or 7.4000000000000004e55 < a < 2.1000000000000002e140

    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 85.9%

      \[\leadsto \color{blue}{\left(\left(b - 0.5\right) \cdot \log c + \left(a + \left(t + z\right)\right)\right)} + y \cdot i \]
    3. Step-by-step derivation
      1. associate-+r+85.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{y \cdot i} \]
    7. Simplified33.8%

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

    if 2.1000000000000002e140 < 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. Step-by-step derivation
      1. associate-+l+99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto t + \color{blue}{a} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification37.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq 1.8 \cdot 10^{-144}:\\ \;\;\;\;z + t\\ \mathbf{elif}\;a \leq 8.5 \cdot 10^{-7}:\\ \;\;\;\;y \cdot i\\ \mathbf{elif}\;a \leq 7.4 \cdot 10^{+55}:\\ \;\;\;\;z + t\\ \mathbf{elif}\;a \leq 2.1 \cdot 10^{+140}:\\ \;\;\;\;y \cdot i\\ \mathbf{else}:\\ \;\;\;\;t + a\\ \end{array} \]

Alternative 10: 41.2% accurate, 31.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -2.4 \cdot 10^{+215}:\\ \;\;\;\;z + t\\ \mathbf{else}:\\ \;\;\;\;a + y \cdot i\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (if (<= z -2.4e+215) (+ z t) (+ a (* y i))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if (z <= -2.4e+215) {
		tmp = z + t;
	} else {
		tmp = a + (y * i);
	}
	return tmp;
}
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.4d+215)) then
        tmp = z + t
    else
        tmp = a + (y * i)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if (z <= -2.4e+215) {
		tmp = z + t;
	} else {
		tmp = a + (y * i);
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	tmp = 0
	if z <= -2.4e+215:
		tmp = z + t
	else:
		tmp = a + (y * i)
	return tmp
function code(x, y, z, t, a, b, c, i)
	tmp = 0.0
	if (z <= -2.4e+215)
		tmp = Float64(z + t);
	else
		tmp = Float64(a + Float64(y * i));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	tmp = 0.0;
	if (z <= -2.4e+215)
		tmp = z + t;
	else
		tmp = a + (y * i);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[z, -2.4e+215], N[(z + t), $MachinePrecision], N[(a + N[(y * i), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.4 \cdot 10^{+215}:\\
\;\;\;\;z + t\\

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


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

    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. Step-by-step derivation
      1. associate-+l+99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.4000000000000001e215 < 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 y around inf 99.8%

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

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

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

Alternative 11: 42.3% accurate, 31.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -1.15 \cdot 10^{+201}:\\ \;\;\;\;z + y \cdot i\\ \mathbf{else}:\\ \;\;\;\;a + y \cdot i\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (if (<= z -1.15e+201) (+ z (* y i)) (+ a (* y i))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if (z <= -1.15e+201) {
		tmp = z + (y * i);
	} else {
		tmp = a + (y * i);
	}
	return tmp;
}
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.15d+201)) then
        tmp = z + (y * i)
    else
        tmp = a + (y * i)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if (z <= -1.15e+201) {
		tmp = z + (y * i);
	} else {
		tmp = a + (y * i);
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	tmp = 0
	if z <= -1.15e+201:
		tmp = z + (y * i)
	else:
		tmp = a + (y * i)
	return tmp
function code(x, y, z, t, a, b, c, i)
	tmp = 0.0
	if (z <= -1.15e+201)
		tmp = Float64(z + Float64(y * i));
	else
		tmp = Float64(a + Float64(y * i));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	tmp = 0.0;
	if (z <= -1.15e+201)
		tmp = z + (y * i);
	else
		tmp = a + (y * i);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[z, -1.15e+201], N[(z + N[(y * i), $MachinePrecision]), $MachinePrecision], N[(a + N[(y * i), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.15 \cdot 10^{+201}:\\
\;\;\;\;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.1500000000000001e201

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

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

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

    if -1.1500000000000001e201 < 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 y around inf 99.8%

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

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

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

Alternative 12: 28.2% accurate, 43.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq 3.8 \cdot 10^{+140}:\\
\;\;\;\;y \cdot i\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < 3.8000000000000001e140

    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 83.1%

      \[\leadsto \color{blue}{\left(\left(b - 0.5\right) \cdot \log c + \left(a + \left(t + z\right)\right)\right)} + y \cdot i \]
    3. Step-by-step derivation
      1. associate-+r+83.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{y \cdot i} \]
    7. Simplified28.4%

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

    if 3.8000000000000001e140 < 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. Step-by-step derivation
      1. associate-+l+99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq 3.8 \cdot 10^{+140}:\\ \;\;\;\;y \cdot i\\ \mathbf{else}:\\ \;\;\;\;t + a\\ \end{array} \]

Alternative 13: 23.4% accurate, 73.0× speedup?

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

\\
y \cdot i
\end{array}
Derivation
  1. Initial program 99.8%

    \[\left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \left(b - 0.5\right) \cdot \log c\right) + y \cdot i \]
  2. Taylor expanded in x around 0 84.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. Step-by-step derivation
    1. associate-+r+84.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{y \cdot i} \]
  7. Simplified26.8%

    \[\leadsto \color{blue}{y \cdot i} \]
  8. Final simplification26.8%

    \[\leadsto y \cdot i \]

Reproduce

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