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

Percentage Accurate: 99.8% → 99.8%
Time: 18.9s
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(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}
Derivation
  1. Initial program 99.9%

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

    \[\leadsto \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 \]

Alternative 2: 89.8% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.9 \cdot 10^{+211} \lor \neg \left(x \leq 3.8 \cdot 10^{+180}\right):\\
\;\;\;\;x \cdot \log y + y \cdot i\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.90000000000000008e211 or 3.8e180 < 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. Taylor expanded in x around inf 80.5%

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

    if -1.90000000000000008e211 < x < 3.8e180

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 98.0% accurate, 1.0× speedup?

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

\\
y \cdot i + \left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + b \cdot \log c\right)
\end{array}
Derivation
  1. Initial program 99.9%

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

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

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

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

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

Alternative 4: 82.5% accurate, 1.0× speedup?

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

\\
y \cdot i + \left(b \cdot \log c + \left(\left(x \cdot \log y + z\right) + a\right)\right)
\end{array}
Derivation
  1. Initial program 99.9%

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

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

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

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

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

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

Alternative 5: 89.8% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.8 \cdot 10^{+211} \lor \neg \left(x \leq 8 \cdot 10^{+180}\right):\\
\;\;\;\;x \cdot \log y + y \cdot i\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.80000000000000001e211 or 8.0000000000000001e180 < 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. Taylor expanded in x around inf 80.5%

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

    if -1.80000000000000001e211 < x < 8.0000000000000001e180

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

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

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

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

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

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

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

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

Alternative 6: 88.1% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.8 \cdot 10^{+211} \lor \neg \left(x \leq 9 \cdot 10^{+180}\right):\\
\;\;\;\;x \cdot \log y + y \cdot i\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.80000000000000001e211 or 8.99999999999999962e180 < 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. Taylor expanded in x around inf 80.5%

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

    if -1.80000000000000001e211 < x < 8.99999999999999962e180

    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 b around inf 98.6%

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

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

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

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

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

Alternative 7: 73.3% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.8 \cdot 10^{+211} \lor \neg \left(x \leq 7.8 \cdot 10^{+180}\right):\\ \;\;\;\;x \cdot \log y + y \cdot i\\ \mathbf{else}:\\ \;\;\;\;y \cdot i + \left(t + \left(z + a\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (if (or (<= x -1.8e+211) (not (<= x 7.8e+180)))
   (+ (* x (log y)) (* y i))
   (+ (* y i) (+ t (+ z a)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if ((x <= -1.8e+211) || !(x <= 7.8e+180)) {
		tmp = (x * log(y)) + (y * i);
	} else {
		tmp = (y * i) + (t + (z + 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 ((x <= (-1.8d+211)) .or. (.not. (x <= 7.8d+180))) then
        tmp = (x * log(y)) + (y * i)
    else
        tmp = (y * i) + (t + (z + 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 ((x <= -1.8e+211) || !(x <= 7.8e+180)) {
		tmp = (x * Math.log(y)) + (y * i);
	} else {
		tmp = (y * i) + (t + (z + a));
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	tmp = 0
	if (x <= -1.8e+211) or not (x <= 7.8e+180):
		tmp = (x * math.log(y)) + (y * i)
	else:
		tmp = (y * i) + (t + (z + a))
	return tmp
function code(x, y, z, t, a, b, c, i)
	tmp = 0.0
	if ((x <= -1.8e+211) || !(x <= 7.8e+180))
		tmp = Float64(Float64(x * log(y)) + Float64(y * i));
	else
		tmp = Float64(Float64(y * i) + Float64(t + Float64(z + a)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	tmp = 0.0;
	if ((x <= -1.8e+211) || ~((x <= 7.8e+180)))
		tmp = (x * log(y)) + (y * i);
	else
		tmp = (y * i) + (t + (z + a));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[x, -1.8e+211], N[Not[LessEqual[x, 7.8e+180]], $MachinePrecision]], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(y * i), $MachinePrecision]), $MachinePrecision], N[(N[(y * i), $MachinePrecision] + N[(t + N[(z + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.8 \cdot 10^{+211} \lor \neg \left(x \leq 7.8 \cdot 10^{+180}\right):\\
\;\;\;\;x \cdot \log y + y \cdot i\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.80000000000000001e211 or 7.8000000000000002e180 < 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. Taylor expanded in x around inf 80.5%

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

    if -1.80000000000000001e211 < x < 7.8000000000000002e180

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.8 \cdot 10^{+211} \lor \neg \left(x \leq 7.8 \cdot 10^{+180}\right):\\ \;\;\;\;x \cdot \log y + y \cdot i\\ \mathbf{else}:\\ \;\;\;\;y \cdot i + \left(t + \left(z + a\right)\right)\\ \end{array} \]

Alternative 8: 59.3% accurate, 2.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -4 \cdot 10^{+113}:\\
\;\;\;\;y \cdot i + \left(t + \left(z + a\right)\right)\\

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4e113 < z

    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 b around inf 98.5%

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

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

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

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

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

Alternative 9: 66.2% accurate, 24.3× speedup?

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

\\
y \cdot i + \left(t + \left(z + a\right)\right)
\end{array}
Derivation
  1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \left(t + \left(z + \color{blue}{a}\right)\right) + y \cdot i \]
  6. Final simplification70.3%

    \[\leadsto y \cdot i + \left(t + \left(z + a\right)\right) \]

Alternative 10: 42.0% accurate, 31.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -1.46 \cdot 10^{+78}:\\ \;\;\;\;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.46e+78) (+ 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.46e+78) {
		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.46d+78)) 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.46e+78) {
		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.46e+78:
		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.46e+78)
		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.46e+78)
		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.46e+78], 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.46 \cdot 10^{+78}:\\
\;\;\;\;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.46000000000000005e78

    1. Initial program 99.9%

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

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

    if -1.46000000000000005e78 < z

    1. Initial program 99.9%

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

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

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

Alternative 11: 27.1% accurate, 43.3× speedup?

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

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

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


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

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

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

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

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

    if 1.1600000000000001e107 < a

    1. Initial program 99.9%

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

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

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

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

Alternative 12: 37.7% accurate, 43.8× speedup?

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

\\
a + y \cdot i
\end{array}
Derivation
  1. Initial program 99.9%

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

    \[\leadsto \color{blue}{a} + y \cdot i \]
  3. Final simplification39.2%

    \[\leadsto a + y \cdot i \]

Alternative 13: 15.7% accurate, 219.0× speedup?

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

\\
a
\end{array}
Derivation
  1. Initial program 99.9%

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

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

    \[\leadsto \color{blue}{a} \]
  4. Final simplification17.9%

    \[\leadsto a \]

Reproduce

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