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

Percentage Accurate: 99.9% → 99.9%
Time: 12.2s
Alternatives: 11
Speedup: 1.0×

Specification

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

\\
\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b
\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 11 alternatives:

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

Initial Program: 99.9% accurate, 1.0× speedup?

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

\\
\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b
\end{array}

Alternative 1: 99.9% accurate, 1.0× speedup?

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

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

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

    \[\leadsto \left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
  4. Add Preprocessing

Alternative 2: 92.0% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
t_1 := \left(a - 0.5\right) \cdot b\\
\mathbf{if}\;z \leq -4.2 \cdot 10^{+120} \lor \neg \left(z \leq 1.06 \cdot 10^{+117}\right):\\
\;\;\;\;t\_1 + \left(x + \left(z - z \cdot \log t\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\left(x + y\right) + t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -4.2000000000000001e120 or 1.06e117 < z

    1. Initial program 99.7%

      \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 91.0%

      \[\leadsto \color{blue}{\left(\left(x + z\right) - z \cdot \log t\right)} + \left(a - 0.5\right) \cdot b \]
    4. Step-by-step derivation
      1. associate--l+91.1%

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

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

    if -4.2000000000000001e120 < z < 1.06e117

    1. Initial program 100.0%

      \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 95.6%

      \[\leadsto \color{blue}{\left(x + y\right)} + \left(a - 0.5\right) \cdot b \]
    4. Step-by-step derivation
      1. +-commutative95.6%

        \[\leadsto \color{blue}{\left(y + x\right)} + \left(a - 0.5\right) \cdot b \]
    5. Simplified95.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -4.2 \cdot 10^{+120} \lor \neg \left(z \leq 1.06 \cdot 10^{+117}\right):\\ \;\;\;\;\left(a - 0.5\right) \cdot b + \left(x + \left(z - z \cdot \log t\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x + y\right) + \left(a - 0.5\right) \cdot b\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 89.1% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(a - 0.5\right) \cdot b\\ \mathbf{if}\;z \leq -7.2 \cdot 10^{+148} \lor \neg \left(z \leq 3.4 \cdot 10^{+153}\right):\\ \;\;\;\;t\_1 + z \cdot \left(1 - \log t\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x + y\right) + t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (* (- a 0.5) b)))
   (if (or (<= z -7.2e+148) (not (<= z 3.4e+153)))
     (+ t_1 (* z (- 1.0 (log t))))
     (+ (+ x y) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = (a - 0.5) * b;
	double tmp;
	if ((z <= -7.2e+148) || !(z <= 3.4e+153)) {
		tmp = t_1 + (z * (1.0 - log(t)));
	} else {
		tmp = (x + y) + t_1;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b)
    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) :: t_1
    real(8) :: tmp
    t_1 = (a - 0.5d0) * b
    if ((z <= (-7.2d+148)) .or. (.not. (z <= 3.4d+153))) then
        tmp = t_1 + (z * (1.0d0 - log(t)))
    else
        tmp = (x + y) + t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = (a - 0.5) * b;
	double tmp;
	if ((z <= -7.2e+148) || !(z <= 3.4e+153)) {
		tmp = t_1 + (z * (1.0 - Math.log(t)));
	} else {
		tmp = (x + y) + t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	t_1 = (a - 0.5) * b
	tmp = 0
	if (z <= -7.2e+148) or not (z <= 3.4e+153):
		tmp = t_1 + (z * (1.0 - math.log(t)))
	else:
		tmp = (x + y) + t_1
	return tmp
function code(x, y, z, t, a, b)
	t_1 = Float64(Float64(a - 0.5) * b)
	tmp = 0.0
	if ((z <= -7.2e+148) || !(z <= 3.4e+153))
		tmp = Float64(t_1 + Float64(z * Float64(1.0 - log(t))));
	else
		tmp = Float64(Float64(x + y) + t_1);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = (a - 0.5) * b;
	tmp = 0.0;
	if ((z <= -7.2e+148) || ~((z <= 3.4e+153)))
		tmp = t_1 + (z * (1.0 - log(t)));
	else
		tmp = (x + y) + t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision]}, If[Or[LessEqual[z, -7.2e+148], N[Not[LessEqual[z, 3.4e+153]], $MachinePrecision]], N[(t$95$1 + N[(z * N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + y), $MachinePrecision] + t$95$1), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left(a - 0.5\right) \cdot b\\
\mathbf{if}\;z \leq -7.2 \cdot 10^{+148} \lor \neg \left(z \leq 3.4 \cdot 10^{+153}\right):\\
\;\;\;\;t\_1 + z \cdot \left(1 - \log t\right)\\

\mathbf{else}:\\
\;\;\;\;\left(x + y\right) + t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -7.20000000000000013e148 or 3.3999999999999997e153 < z

    1. Initial program 99.7%

      \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
    2. Add Preprocessing
    3. Taylor expanded in z around -inf 87.7%

      \[\leadsto \color{blue}{z \cdot \left(1 + -1 \cdot \log t\right)} + \left(a - 0.5\right) \cdot b \]
    4. Taylor expanded in t around inf 87.7%

      \[\leadsto \color{blue}{z \cdot \left(1 + \log \left(\frac{1}{t}\right)\right)} + \left(a - 0.5\right) \cdot b \]
    5. Step-by-step derivation
      1. log-rec87.7%

        \[\leadsto z \cdot \left(1 + \color{blue}{\left(-\log t\right)}\right) + \left(a - 0.5\right) \cdot b \]
      2. sub-neg87.7%

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

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

    if -7.20000000000000013e148 < z < 3.3999999999999997e153

    1. Initial program 100.0%

      \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 94.6%

      \[\leadsto \color{blue}{\left(x + y\right)} + \left(a - 0.5\right) \cdot b \]
    4. Step-by-step derivation
      1. +-commutative94.6%

        \[\leadsto \color{blue}{\left(y + x\right)} + \left(a - 0.5\right) \cdot b \]
    5. Simplified94.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -7.2 \cdot 10^{+148} \lor \neg \left(z \leq 3.4 \cdot 10^{+153}\right):\\ \;\;\;\;\left(a - 0.5\right) \cdot b + z \cdot \left(1 - \log t\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x + y\right) + \left(a - 0.5\right) \cdot b\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 89.1% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_1 := \left(a - 0.5\right) \cdot b\\
\mathbf{if}\;z \leq -4.1 \cdot 10^{+151}:\\
\;\;\;\;t\_1 + z \cdot \left(1 - \log t\right)\\

\mathbf{elif}\;z \leq 4.6 \cdot 10^{+195}:\\
\;\;\;\;\left(x + y\right) + t\_1\\

\mathbf{else}:\\
\;\;\;\;\left(x + \left(z - z \cdot \log t\right)\right) + a \cdot b\\


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

    1. Initial program 99.7%

      \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
    2. Add Preprocessing
    3. Taylor expanded in z around -inf 86.7%

      \[\leadsto \color{blue}{z \cdot \left(1 + -1 \cdot \log t\right)} + \left(a - 0.5\right) \cdot b \]
    4. Taylor expanded in t around inf 86.7%

      \[\leadsto \color{blue}{z \cdot \left(1 + \log \left(\frac{1}{t}\right)\right)} + \left(a - 0.5\right) \cdot b \]
    5. Step-by-step derivation
      1. log-rec86.7%

        \[\leadsto z \cdot \left(1 + \color{blue}{\left(-\log t\right)}\right) + \left(a - 0.5\right) \cdot b \]
      2. sub-neg86.7%

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

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

    if -4.0999999999999998e151 < z < 4.6000000000000002e195

    1. Initial program 100.0%

      \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 93.7%

      \[\leadsto \color{blue}{\left(x + y\right)} + \left(a - 0.5\right) \cdot b \]
    4. Step-by-step derivation
      1. +-commutative93.7%

        \[\leadsto \color{blue}{\left(y + x\right)} + \left(a - 0.5\right) \cdot b \]
    5. Simplified93.7%

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

    if 4.6000000000000002e195 < z

    1. Initial program 99.6%

      \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 93.2%

      \[\leadsto \color{blue}{\left(\left(x + z\right) - z \cdot \log t\right)} + \left(a - 0.5\right) \cdot b \]
    4. Step-by-step derivation
      1. associate--l+93.2%

        \[\leadsto \color{blue}{\left(x + \left(z - z \cdot \log t\right)\right)} + \left(a - 0.5\right) \cdot b \]
    5. Simplified93.2%

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

      \[\leadsto \left(x + \left(z - z \cdot \log t\right)\right) + \color{blue}{a \cdot b} \]
    7. Step-by-step derivation
      1. *-commutative19.0%

        \[\leadsto y + \color{blue}{b \cdot a} \]
    8. Simplified90.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -4.1 \cdot 10^{+151}:\\ \;\;\;\;\left(a - 0.5\right) \cdot b + z \cdot \left(1 - \log t\right)\\ \mathbf{elif}\;z \leq 4.6 \cdot 10^{+195}:\\ \;\;\;\;\left(x + y\right) + \left(a - 0.5\right) \cdot b\\ \mathbf{else}:\\ \;\;\;\;\left(x + \left(z - z \cdot \log t\right)\right) + a \cdot b\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 89.7% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_1 := z \cdot \log t\\
\mathbf{if}\;z \leq -5 \cdot 10^{+120}:\\
\;\;\;\;\left(z + \left(y - t\_1\right)\right) + a \cdot b\\

\mathbf{elif}\;z \leq 4.6 \cdot 10^{+195}:\\
\;\;\;\;\left(x + y\right) + \left(a - 0.5\right) \cdot b\\

\mathbf{else}:\\
\;\;\;\;\left(x + \left(z - t\_1\right)\right) + a \cdot b\\


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

    1. Initial program 99.7%

      \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 94.8%

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

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

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

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

      \[\leadsto \left(z + \left(y - z \cdot \log t\right)\right) + \color{blue}{a \cdot b} \]
    7. Step-by-step derivation
      1. *-commutative32.9%

        \[\leadsto y + \color{blue}{b \cdot a} \]
    8. Simplified88.3%

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

    if -5.00000000000000019e120 < z < 4.6000000000000002e195

    1. Initial program 100.0%

      \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 94.3%

      \[\leadsto \color{blue}{\left(x + y\right)} + \left(a - 0.5\right) \cdot b \]
    4. Step-by-step derivation
      1. +-commutative94.3%

        \[\leadsto \color{blue}{\left(y + x\right)} + \left(a - 0.5\right) \cdot b \]
    5. Simplified94.3%

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

    if 4.6000000000000002e195 < z

    1. Initial program 99.6%

      \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 93.2%

      \[\leadsto \color{blue}{\left(\left(x + z\right) - z \cdot \log t\right)} + \left(a - 0.5\right) \cdot b \]
    4. Step-by-step derivation
      1. associate--l+93.2%

        \[\leadsto \color{blue}{\left(x + \left(z - z \cdot \log t\right)\right)} + \left(a - 0.5\right) \cdot b \]
    5. Simplified93.2%

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

      \[\leadsto \left(x + \left(z - z \cdot \log t\right)\right) + \color{blue}{a \cdot b} \]
    7. Step-by-step derivation
      1. *-commutative19.0%

        \[\leadsto y + \color{blue}{b \cdot a} \]
    8. Simplified90.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -5 \cdot 10^{+120}:\\ \;\;\;\;\left(z + \left(y - z \cdot \log t\right)\right) + a \cdot b\\ \mathbf{elif}\;z \leq 4.6 \cdot 10^{+195}:\\ \;\;\;\;\left(x + y\right) + \left(a - 0.5\right) \cdot b\\ \mathbf{else}:\\ \;\;\;\;\left(x + \left(z - z \cdot \log t\right)\right) + a \cdot b\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 85.1% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_1 := z \cdot \log t\\
t_2 := \left(a - 0.5\right) \cdot b\\
\mathbf{if}\;x \leq -1.8 \cdot 10^{+28}:\\
\;\;\;\;t\_2 + \left(x + \left(z - t\_1\right)\right)\\

\mathbf{else}:\\
\;\;\;\;t\_2 + \left(z + \left(y - t\_1\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.8e28

    1. Initial program 99.8%

      \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 86.4%

      \[\leadsto \color{blue}{\left(\left(x + z\right) - z \cdot \log t\right)} + \left(a - 0.5\right) \cdot b \]
    4. Step-by-step derivation
      1. associate--l+86.4%

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

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

    if -1.8e28 < x

    1. Initial program 99.9%

      \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 88.0%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.8 \cdot 10^{+28}:\\ \;\;\;\;\left(a - 0.5\right) \cdot b + \left(x + \left(z - z \cdot \log t\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(a - 0.5\right) \cdot b + \left(z + \left(y - z \cdot \log t\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 57.2% accurate, 7.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.2 \cdot 10^{-21} \lor \neg \left(a \leq 3.1 \cdot 10^{+23}\right):\\
\;\;\;\;y + a \cdot b\\

\mathbf{else}:\\
\;\;\;\;y + b \cdot -0.5\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -3.2000000000000002e-21 or 3.09999999999999971e23 < a

    1. Initial program 99.9%

      \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 62.8%

      \[\leadsto \color{blue}{y} + \left(a - 0.5\right) \cdot b \]
    4. Taylor expanded in a around inf 62.7%

      \[\leadsto y + \color{blue}{a \cdot b} \]
    5. Step-by-step derivation
      1. *-commutative62.7%

        \[\leadsto y + \color{blue}{b \cdot a} \]
    6. Simplified62.7%

      \[\leadsto y + \color{blue}{b \cdot a} \]

    if -3.2000000000000002e-21 < a < 3.09999999999999971e23

    1. Initial program 99.8%

      \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 53.1%

      \[\leadsto \color{blue}{y} + \left(a - 0.5\right) \cdot b \]
    4. Taylor expanded in a around 0 53.1%

      \[\leadsto y + \color{blue}{-0.5 \cdot b} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification57.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -3.2 \cdot 10^{-21} \lor \neg \left(a \leq 3.1 \cdot 10^{+23}\right):\\ \;\;\;\;y + a \cdot b\\ \mathbf{else}:\\ \;\;\;\;y + b \cdot -0.5\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 63.8% accurate, 9.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.48 \cdot 10^{+103}:\\
\;\;\;\;x + \left(a - 0.5\right) \cdot b\\

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


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

    1. Initial program 99.9%

      \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 61.8%

      \[\leadsto \color{blue}{x} + \left(a - 0.5\right) \cdot b \]

    if 1.48000000000000009e103 < y

    1. Initial program 99.9%

      \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 71.4%

      \[\leadsto \color{blue}{y} + \left(a - 0.5\right) \cdot b \]
    4. Taylor expanded in a around inf 67.2%

      \[\leadsto y + \color{blue}{a \cdot b} \]
    5. Step-by-step derivation
      1. *-commutative67.2%

        \[\leadsto y + \color{blue}{b \cdot a} \]
    6. Simplified67.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 1.48 \cdot 10^{+103}:\\ \;\;\;\;x + \left(a - 0.5\right) \cdot b\\ \mathbf{else}:\\ \;\;\;\;y + a \cdot b\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 64.5% accurate, 9.6× speedup?

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

\\
\begin{array}{l}
t_1 := \left(a - 0.5\right) \cdot b\\
\mathbf{if}\;y \leq 5.2 \cdot 10^{+14}:\\
\;\;\;\;x + t\_1\\

\mathbf{else}:\\
\;\;\;\;y + t\_1\\


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

    1. Initial program 99.9%

      \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 63.5%

      \[\leadsto \color{blue}{x} + \left(a - 0.5\right) \cdot b \]

    if 5.2e14 < y

    1. Initial program 99.9%

      \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 66.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 5.2 \cdot 10^{+14}:\\ \;\;\;\;x + \left(a - 0.5\right) \cdot b\\ \mathbf{else}:\\ \;\;\;\;y + \left(a - 0.5\right) \cdot b\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 78.8% accurate, 12.8× speedup?

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

\\
\left(x + y\right) + \left(a - 0.5\right) \cdot b
\end{array}
Derivation
  1. Initial program 99.9%

    \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
  2. Add Preprocessing
  3. Taylor expanded in z around 0 77.6%

    \[\leadsto \color{blue}{\left(x + y\right)} + \left(a - 0.5\right) \cdot b \]
  4. Step-by-step derivation
    1. +-commutative77.6%

      \[\leadsto \color{blue}{\left(y + x\right)} + \left(a - 0.5\right) \cdot b \]
  5. Simplified77.6%

    \[\leadsto \color{blue}{\left(y + x\right)} + \left(a - 0.5\right) \cdot b \]
  6. Final simplification77.6%

    \[\leadsto \left(x + y\right) + \left(a - 0.5\right) \cdot b \]
  7. Add Preprocessing

Alternative 11: 34.2% accurate, 23.0× speedup?

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

\\
y + b \cdot -0.5
\end{array}
Derivation
  1. Initial program 99.9%

    \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
  2. Add Preprocessing
  3. Taylor expanded in y around inf 57.7%

    \[\leadsto \color{blue}{y} + \left(a - 0.5\right) \cdot b \]
  4. Taylor expanded in a around 0 37.9%

    \[\leadsto y + \color{blue}{-0.5 \cdot b} \]
  5. Final simplification37.9%

    \[\leadsto y + b \cdot -0.5 \]
  6. Add Preprocessing

Developer target: 99.5% accurate, 0.4× speedup?

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

\\
\left(\left(x + y\right) + \frac{\left(1 - {\log t}^{2}\right) \cdot z}{1 + \log t}\right) + \left(a - 0.5\right) \cdot b
\end{array}

Reproduce

?
herbie shell --seed 2024067 
(FPCore (x y z t a b)
  :name "Numeric.SpecFunctions:logBeta from math-functions-0.1.5.2, A"
  :precision binary64

  :alt
  (+ (+ (+ x y) (/ (* (- 1.0 (pow (log t) 2.0)) z) (+ 1.0 (log t)))) (* (- a 0.5) b))

  (+ (- (+ (+ x y) z) (* z (log t))) (* (- a 0.5) b)))