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

Percentage Accurate: 99.8% → 99.8%
Time: 16.6s
Alternatives: 15
Speedup: 1.0×

Specification

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

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

Initial Program: 99.8% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 99.8% accurate, 0.4× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 99.8% accurate, 0.7× speedup?

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

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

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

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

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

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

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

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

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

Alternative 4: 93.1% accurate, 1.0× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -5.99999999999999981e165 or 5.30000000000000012e175 < x

    1. Initial program 99.6%

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

        \[\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. associate-+l+99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.99999999999999981e165 < x < 5.30000000000000012e175

    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. +-commutative99.9%

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 99.8% accurate, 1.0× speedup?

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

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

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

Alternative 6: 93.2% accurate, 1.0× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.2499999999999999e167 or 9.40000000000000037e163 < x

    1. Initial program 99.6%

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

        \[\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. associate-+l+99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto y \cdot i + \left(\log y \cdot x + \color{blue}{\left(a + \log c \cdot b\right)}\right) \]
    7. Step-by-step derivation
      1. +-commutative89.5%

        \[\leadsto y \cdot i + \left(\log y \cdot x + \color{blue}{\left(\log c \cdot b + a\right)}\right) \]
      2. *-commutative89.5%

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

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

    if -1.2499999999999999e167 < x < 9.40000000000000037e163

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

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

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

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

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

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

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

Alternative 7: 93.0% accurate, 1.0× speedup?

\[\begin{array}{l} [z, t, a] = \mathsf{sort}([z, t, a])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -3.2 \cdot 10^{+167} \lor \neg \left(x \leq 1.65 \cdot 10^{+171}\right):\\ \;\;\;\;y \cdot i + \left(x \cdot \log y + \left(a + b \cdot \log c\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y, i, a + \left(\log c \cdot \left(b - 0.5\right) + \left(z + t\right)\right)\right)\\ \end{array} \end{array} \]
NOTE: z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i)
 :precision binary64
 (if (or (<= x -3.2e+167) (not (<= x 1.65e+171)))
   (+ (* y i) (+ (* x (log y)) (+ a (* b (log c)))))
   (fma y i (+ a (+ (* (log c) (- b 0.5)) (+ z t))))))
assert(z < t && t < a);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if ((x <= -3.2e+167) || !(x <= 1.65e+171)) {
		tmp = (y * i) + ((x * log(y)) + (a + (b * log(c))));
	} else {
		tmp = fma(y, i, (a + ((log(c) * (b - 0.5)) + (z + t))));
	}
	return tmp;
}
z, t, a = sort([z, t, a])
function code(x, y, z, t, a, b, c, i)
	tmp = 0.0
	if ((x <= -3.2e+167) || !(x <= 1.65e+171))
		tmp = Float64(Float64(y * i) + Float64(Float64(x * log(y)) + Float64(a + Float64(b * log(c)))));
	else
		tmp = fma(y, i, Float64(a + Float64(Float64(log(c) * Float64(b - 0.5)) + Float64(z + t))));
	end
	return tmp
end
NOTE: z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[x, -3.2e+167], N[Not[LessEqual[x, 1.65e+171]], $MachinePrecision]], N[(N[(y * i), $MachinePrecision] + N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(a + N[(b * N[Log[c], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * i + N[(a + N[(N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision]), $MachinePrecision] + N[(z + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[z, t, a] = \mathsf{sort}([z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.2 \cdot 10^{+167} \lor \neg \left(x \leq 1.65 \cdot 10^{+171}\right):\\
\;\;\;\;y \cdot i + \left(x \cdot \log y + \left(a + b \cdot \log c\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -3.19999999999999981e167 or 1.64999999999999996e171 < x

    1. Initial program 99.6%

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

        \[\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. associate-+l+99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto y \cdot i + \left(\log y \cdot x + \color{blue}{\left(a + \log c \cdot b\right)}\right) \]
    7. Step-by-step derivation
      1. +-commutative89.5%

        \[\leadsto y \cdot i + \left(\log y \cdot x + \color{blue}{\left(\log c \cdot b + a\right)}\right) \]
      2. *-commutative89.5%

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

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

    if -3.19999999999999981e167 < x < 1.64999999999999996e171

    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. +-commutative99.9%

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 91.4% accurate, 1.8× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.5500000000000001e211 or 1.74999999999999993e186 < x

    1. Initial program 99.6%

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

        \[\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. associate-+l+99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto y \cdot i + \left(\log y \cdot x + \color{blue}{\left(a + t\right)}\right) \]
    7. Step-by-step derivation
      1. +-commutative81.6%

        \[\leadsto y \cdot i + \left(\log y \cdot x + \color{blue}{\left(t + a\right)}\right) \]
    8. Simplified81.6%

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

    if -1.5500000000000001e211 < x < 1.74999999999999993e186

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

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

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

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

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

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

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

Alternative 9: 76.1% accurate, 1.9× speedup?

\[\begin{array}{l} [z, t, a] = \mathsf{sort}([z, t, a])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -2.4 \cdot 10^{+168} \lor \neg \left(x \leq 1.42 \cdot 10^{+184}\right):\\ \;\;\;\;y \cdot i + \left(\left(t + a\right) + x \cdot \log y\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y, i, z + \left(t + a\right)\right)\\ \end{array} \end{array} \]
NOTE: z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i)
 :precision binary64
 (if (or (<= x -2.4e+168) (not (<= x 1.42e+184)))
   (+ (* y i) (+ (+ t a) (* x (log y))))
   (fma y i (+ z (+ t a)))))
assert(z < t && t < a);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if ((x <= -2.4e+168) || !(x <= 1.42e+184)) {
		tmp = (y * i) + ((t + a) + (x * log(y)));
	} else {
		tmp = fma(y, i, (z + (t + a)));
	}
	return tmp;
}
z, t, a = sort([z, t, a])
function code(x, y, z, t, a, b, c, i)
	tmp = 0.0
	if ((x <= -2.4e+168) || !(x <= 1.42e+184))
		tmp = Float64(Float64(y * i) + Float64(Float64(t + a) + Float64(x * log(y))));
	else
		tmp = fma(y, i, Float64(z + Float64(t + a)));
	end
	return tmp
end
NOTE: z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[x, -2.4e+168], N[Not[LessEqual[x, 1.42e+184]], $MachinePrecision]], N[(N[(y * i), $MachinePrecision] + N[(N[(t + a), $MachinePrecision] + N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * i + N[(z + N[(t + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[z, t, a] = \mathsf{sort}([z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.4 \cdot 10^{+168} \lor \neg \left(x \leq 1.42 \cdot 10^{+184}\right):\\
\;\;\;\;y \cdot i + \left(\left(t + a\right) + x \cdot \log y\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.40000000000000009e168 or 1.42000000000000002e184 < x

    1. Initial program 99.6%

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

        \[\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. associate-+l+99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto y \cdot i + \left(\log y \cdot x + \color{blue}{\left(a + t\right)}\right) \]
    7. Step-by-step derivation
      1. +-commutative78.6%

        \[\leadsto y \cdot i + \left(\log y \cdot x + \color{blue}{\left(t + a\right)}\right) \]
    8. Simplified78.6%

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

    if -2.40000000000000009e168 < x < 1.42000000000000002e184

    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. +-commutative99.9%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(y, i, \color{blue}{a + \left(t + z\right)}\right) \]
    7. Step-by-step derivation
      1. +-commutative78.1%

        \[\leadsto \mathsf{fma}\left(y, i, a + \color{blue}{\left(z + t\right)}\right) \]
      2. +-commutative78.1%

        \[\leadsto \mathsf{fma}\left(y, i, \color{blue}{\left(z + t\right) + a}\right) \]
      3. associate-+l+78.1%

        \[\leadsto \mathsf{fma}\left(y, i, \color{blue}{z + \left(t + a\right)}\right) \]
    8. Simplified78.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.4 \cdot 10^{+168} \lor \neg \left(x \leq 1.42 \cdot 10^{+184}\right):\\ \;\;\;\;y \cdot i + \left(\left(t + a\right) + x \cdot \log y\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y, i, z + \left(t + a\right)\right)\\ \end{array} \]

Alternative 10: 67.2% accurate, 2.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \mathsf{fma}\left(y, i, \color{blue}{a + \left(t + z\right)}\right) \]
  7. Step-by-step derivation
    1. +-commutative66.0%

      \[\leadsto \mathsf{fma}\left(y, i, a + \color{blue}{\left(z + t\right)}\right) \]
    2. +-commutative66.0%

      \[\leadsto \mathsf{fma}\left(y, i, \color{blue}{\left(z + t\right) + a}\right) \]
    3. associate-+l+66.0%

      \[\leadsto \mathsf{fma}\left(y, i, \color{blue}{z + \left(t + a\right)}\right) \]
  8. Simplified66.0%

    \[\leadsto \mathsf{fma}\left(y, i, \color{blue}{z + \left(t + a\right)}\right) \]
  9. Final simplification66.0%

    \[\leadsto \mathsf{fma}\left(y, i, z + \left(t + a\right)\right) \]

Alternative 11: 45.0% accurate, 2.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \mathsf{fma}\left(y, i, a + \left(\color{blue}{\log c \cdot b} + \left(t + z\right)\right)\right) \]
  6. Step-by-step derivation
    1. add-sqr-sqrt41.5%

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

      \[\leadsto \mathsf{fma}\left(y, i, a + \left(\color{blue}{{\left(\sqrt{\log c \cdot b}\right)}^{2}} + \left(t + z\right)\right)\right) \]
  7. Applied egg-rr41.5%

    \[\leadsto \mathsf{fma}\left(y, i, a + \left(\color{blue}{{\left(\sqrt{\log c \cdot b}\right)}^{2}} + \left(t + z\right)\right)\right) \]
  8. Taylor expanded in t around inf 52.9%

    \[\leadsto \mathsf{fma}\left(y, i, a + \color{blue}{t}\right) \]
  9. Final simplification52.9%

    \[\leadsto \mathsf{fma}\left(y, i, t + a\right) \]

Alternative 12: 66.7% accurate, 2.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \mathsf{fma}\left(y, i, a + \left(\color{blue}{\log c \cdot b} + \left(t + z\right)\right)\right) \]
  6. Step-by-step derivation
    1. add-sqr-sqrt41.5%

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

      \[\leadsto \mathsf{fma}\left(y, i, a + \left(\color{blue}{{\left(\sqrt{\log c \cdot b}\right)}^{2}} + \left(t + z\right)\right)\right) \]
  7. Applied egg-rr41.5%

    \[\leadsto \mathsf{fma}\left(y, i, a + \left(\color{blue}{{\left(\sqrt{\log c \cdot b}\right)}^{2}} + \left(t + z\right)\right)\right) \]
  8. Taylor expanded in z around inf 51.5%

    \[\leadsto \mathsf{fma}\left(y, i, a + \color{blue}{z}\right) \]
  9. Final simplification51.5%

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

Alternative 13: 44.5% accurate, 2.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \mathsf{fma}\left(y, i, \color{blue}{a}\right) \]
  6. Final simplification38.6%

    \[\leadsto \mathsf{fma}\left(y, i, a\right) \]

Alternative 14: 34.0% accurate, 43.3× speedup?

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

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


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

    1. Initial program 99.8%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(\mathsf{fma}\left(x, \log y, z\right) + \left(t + a\right)\right) + \left(\left(b + -0.5\right) \cdot \log c + y \cdot i\right)} \]
    4. Step-by-step derivation
      1. add-cube-cbrt99.2%

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

      \[\leadsto \left(\color{blue}{\left(\sqrt[3]{\mathsf{fma}\left(x, \log y, z\right)} \cdot \sqrt[3]{\mathsf{fma}\left(x, \log y, z\right)}\right) \cdot \sqrt[3]{\mathsf{fma}\left(x, \log y, z\right)}} + \left(t + a\right)\right) + \left(\left(b + -0.5\right) \cdot \log c + y \cdot i\right) \]
    6. Step-by-step derivation
      1. add-cube-cbrt99.8%

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

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

        \[\leadsto \left(\color{blue}{{\left(\sqrt{\mathsf{fma}\left(x, \log y, z\right)}\right)}^{2}} + \left(t + a\right)\right) + \left(\left(b + -0.5\right) \cdot \log c + y \cdot i\right) \]
    7. Applied egg-rr56.3%

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

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

    if 5.39999999999999975e-30 < 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. associate-+l+99.9%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{y \cdot i} \]
    6. Simplified42.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 5.4 \cdot 10^{-30}:\\ \;\;\;\;a\\ \mathbf{else}:\\ \;\;\;\;y \cdot i\\ \end{array} \]

Alternative 15: 22.9% accurate, 219.0× speedup?

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\left(\mathsf{fma}\left(x, \log y, z\right) + \left(t + a\right)\right) + \left(\left(b + -0.5\right) \cdot \log c + y \cdot i\right)} \]
  4. Step-by-step derivation
    1. add-cube-cbrt99.4%

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

    \[\leadsto \left(\color{blue}{\left(\sqrt[3]{\mathsf{fma}\left(x, \log y, z\right)} \cdot \sqrt[3]{\mathsf{fma}\left(x, \log y, z\right)}\right) \cdot \sqrt[3]{\mathsf{fma}\left(x, \log y, z\right)}} + \left(t + a\right)\right) + \left(\left(b + -0.5\right) \cdot \log c + y \cdot i\right) \]
  6. Step-by-step derivation
    1. add-cube-cbrt99.8%

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

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

      \[\leadsto \left(\color{blue}{{\left(\sqrt{\mathsf{fma}\left(x, \log y, z\right)}\right)}^{2}} + \left(t + a\right)\right) + \left(\left(b + -0.5\right) \cdot \log c + y \cdot i\right) \]
  7. Applied egg-rr56.5%

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

    \[\leadsto \color{blue}{a} \]
  9. Final simplification16.7%

    \[\leadsto a \]

Reproduce

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