System.Random.MWC.Distributions:gamma from mwc-random-0.13.3.2

Percentage Accurate: 99.9% → 99.6%
Time: 10.4s
Alternatives: 7
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ x \cdot 0.5 + y \cdot \left(\left(1 - z\right) + \log z\right) \end{array} \]
(FPCore (x y z) :precision binary64 (+ (* x 0.5) (* y (+ (- 1.0 z) (log z)))))
double code(double x, double y, double z) {
	return (x * 0.5) + (y * ((1.0 - z) + log(z)));
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (x * 0.5d0) + (y * ((1.0d0 - z) + log(z)))
end function
public static double code(double x, double y, double z) {
	return (x * 0.5) + (y * ((1.0 - z) + Math.log(z)));
}
def code(x, y, z):
	return (x * 0.5) + (y * ((1.0 - z) + math.log(z)))
function code(x, y, z)
	return Float64(Float64(x * 0.5) + Float64(y * Float64(Float64(1.0 - z) + log(z))))
end
function tmp = code(x, y, z)
	tmp = (x * 0.5) + (y * ((1.0 - z) + log(z)));
end
code[x_, y_, z_] := N[(N[(x * 0.5), $MachinePrecision] + N[(y * N[(N[(1.0 - z), $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

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

Alternative 1: 99.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ x \cdot 0.5 - \left(y \cdot \left(-1 - \log z\right) + y \cdot z\right) \end{array} \]
(FPCore (x y z)
 :precision binary64
 (- (* x 0.5) (+ (* y (- -1.0 (log z))) (* y z))))
double code(double x, double y, double z) {
	return (x * 0.5) - ((y * (-1.0 - log(z))) + (y * z));
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (x * 0.5d0) - ((y * ((-1.0d0) - log(z))) + (y * z))
end function
public static double code(double x, double y, double z) {
	return (x * 0.5) - ((y * (-1.0 - Math.log(z))) + (y * z));
}
def code(x, y, z):
	return (x * 0.5) - ((y * (-1.0 - math.log(z))) + (y * z))
function code(x, y, z)
	return Float64(Float64(x * 0.5) - Float64(Float64(y * Float64(-1.0 - log(z))) + Float64(y * z)))
end
function tmp = code(x, y, z)
	tmp = (x * 0.5) - ((y * (-1.0 - log(z))) + (y * z));
end
code[x_, y_, z_] := N[(N[(x * 0.5), $MachinePrecision] - N[(N[(y * N[(-1.0 - N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

    \[x \cdot 0.5 + y \cdot \left(\left(1 - z\right) + \log z\right) \]
  2. Step-by-step derivation
    1. cancel-sign-sub99.9%

      \[\leadsto \color{blue}{x \cdot 0.5 - \left(-y\right) \cdot \left(\left(1 - z\right) + \log z\right)} \]
    2. *-commutative99.9%

      \[\leadsto x \cdot 0.5 - \color{blue}{\left(\left(1 - z\right) + \log z\right) \cdot \left(-y\right)} \]
    3. *-commutative99.9%

      \[\leadsto x \cdot 0.5 - \color{blue}{\left(-y\right) \cdot \left(\left(1 - z\right) + \log z\right)} \]
    4. distribute-lft-neg-out99.9%

      \[\leadsto x \cdot 0.5 - \color{blue}{\left(-y \cdot \left(\left(1 - z\right) + \log z\right)\right)} \]
    5. distribute-rgt-neg-in99.9%

      \[\leadsto x \cdot 0.5 - \color{blue}{y \cdot \left(-\left(\left(1 - z\right) + \log z\right)\right)} \]
    6. distribute-neg-in99.9%

      \[\leadsto x \cdot 0.5 - y \cdot \color{blue}{\left(\left(-\left(1 - z\right)\right) + \left(-\log z\right)\right)} \]
    7. unsub-neg99.9%

      \[\leadsto x \cdot 0.5 - y \cdot \color{blue}{\left(\left(-\left(1 - z\right)\right) - \log z\right)} \]
    8. neg-sub099.9%

      \[\leadsto x \cdot 0.5 - y \cdot \left(\color{blue}{\left(0 - \left(1 - z\right)\right)} - \log z\right) \]
    9. associate--r-99.9%

      \[\leadsto x \cdot 0.5 - y \cdot \left(\color{blue}{\left(\left(0 - 1\right) + z\right)} - \log z\right) \]
    10. metadata-eval99.9%

      \[\leadsto x \cdot 0.5 - y \cdot \left(\left(\color{blue}{-1} + z\right) - \log z\right) \]
    11. +-commutative99.9%

      \[\leadsto x \cdot 0.5 - y \cdot \left(\color{blue}{\left(z + -1\right)} - \log z\right) \]
    12. associate--l+99.9%

      \[\leadsto x \cdot 0.5 - y \cdot \color{blue}{\left(z + \left(-1 - \log z\right)\right)} \]
  3. Simplified99.9%

    \[\leadsto \color{blue}{x \cdot 0.5 - y \cdot \left(z + \left(-1 - \log z\right)\right)} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. +-commutative99.9%

      \[\leadsto x \cdot 0.5 - y \cdot \color{blue}{\left(\left(-1 - \log z\right) + z\right)} \]
    2. distribute-lft-in99.9%

      \[\leadsto x \cdot 0.5 - \color{blue}{\left(y \cdot \left(-1 - \log z\right) + y \cdot z\right)} \]
  6. Applied egg-rr99.9%

    \[\leadsto x \cdot 0.5 - \color{blue}{\left(y \cdot \left(-1 - \log z\right) + y \cdot z\right)} \]
  7. Final simplification99.9%

    \[\leadsto x \cdot 0.5 - \left(y \cdot \left(-1 - \log z\right) + y \cdot z\right) \]
  8. Add Preprocessing

Alternative 2: 85.7% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \cdot 0.5 \leq -5 \cdot 10^{-32} \lor \neg \left(x \cdot 0.5 \leq 5 \cdot 10^{-16}\right):\\ \;\;\;\;x \cdot 0.5 - y \cdot z\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(\left(\log z + 1\right) - z\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= (* x 0.5) -5e-32) (not (<= (* x 0.5) 5e-16)))
   (- (* x 0.5) (* y z))
   (* y (- (+ (log z) 1.0) z))))
double code(double x, double y, double z) {
	double tmp;
	if (((x * 0.5) <= -5e-32) || !((x * 0.5) <= 5e-16)) {
		tmp = (x * 0.5) - (y * z);
	} else {
		tmp = y * ((log(z) + 1.0) - z);
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (((x * 0.5d0) <= (-5d-32)) .or. (.not. ((x * 0.5d0) <= 5d-16))) then
        tmp = (x * 0.5d0) - (y * z)
    else
        tmp = y * ((log(z) + 1.0d0) - z)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (((x * 0.5) <= -5e-32) || !((x * 0.5) <= 5e-16)) {
		tmp = (x * 0.5) - (y * z);
	} else {
		tmp = y * ((Math.log(z) + 1.0) - z);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if ((x * 0.5) <= -5e-32) or not ((x * 0.5) <= 5e-16):
		tmp = (x * 0.5) - (y * z)
	else:
		tmp = y * ((math.log(z) + 1.0) - z)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((Float64(x * 0.5) <= -5e-32) || !(Float64(x * 0.5) <= 5e-16))
		tmp = Float64(Float64(x * 0.5) - Float64(y * z));
	else
		tmp = Float64(y * Float64(Float64(log(z) + 1.0) - z));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (((x * 0.5) <= -5e-32) || ~(((x * 0.5) <= 5e-16)))
		tmp = (x * 0.5) - (y * z);
	else
		tmp = y * ((log(z) + 1.0) - z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[N[(x * 0.5), $MachinePrecision], -5e-32], N[Not[LessEqual[N[(x * 0.5), $MachinePrecision], 5e-16]], $MachinePrecision]], N[(N[(x * 0.5), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(N[Log[z], $MachinePrecision] + 1.0), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \cdot 0.5 \leq -5 \cdot 10^{-32} \lor \neg \left(x \cdot 0.5 \leq 5 \cdot 10^{-16}\right):\\
\;\;\;\;x \cdot 0.5 - y \cdot z\\

\mathbf{else}:\\
\;\;\;\;y \cdot \left(\left(\log z + 1\right) - z\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x 1/2) < -5e-32 or 5.0000000000000004e-16 < (*.f64 x 1/2)

    1. Initial program 100.0%

      \[x \cdot 0.5 + y \cdot \left(\left(1 - z\right) + \log z\right) \]
    2. Step-by-step derivation
      1. cancel-sign-sub100.0%

        \[\leadsto \color{blue}{x \cdot 0.5 - \left(-y\right) \cdot \left(\left(1 - z\right) + \log z\right)} \]
      2. *-commutative100.0%

        \[\leadsto x \cdot 0.5 - \color{blue}{\left(\left(1 - z\right) + \log z\right) \cdot \left(-y\right)} \]
      3. *-commutative100.0%

        \[\leadsto x \cdot 0.5 - \color{blue}{\left(-y\right) \cdot \left(\left(1 - z\right) + \log z\right)} \]
      4. distribute-lft-neg-out100.0%

        \[\leadsto x \cdot 0.5 - \color{blue}{\left(-y \cdot \left(\left(1 - z\right) + \log z\right)\right)} \]
      5. distribute-rgt-neg-in100.0%

        \[\leadsto x \cdot 0.5 - \color{blue}{y \cdot \left(-\left(\left(1 - z\right) + \log z\right)\right)} \]
      6. distribute-neg-in100.0%

        \[\leadsto x \cdot 0.5 - y \cdot \color{blue}{\left(\left(-\left(1 - z\right)\right) + \left(-\log z\right)\right)} \]
      7. unsub-neg100.0%

        \[\leadsto x \cdot 0.5 - y \cdot \color{blue}{\left(\left(-\left(1 - z\right)\right) - \log z\right)} \]
      8. neg-sub0100.0%

        \[\leadsto x \cdot 0.5 - y \cdot \left(\color{blue}{\left(0 - \left(1 - z\right)\right)} - \log z\right) \]
      9. associate--r-100.0%

        \[\leadsto x \cdot 0.5 - y \cdot \left(\color{blue}{\left(\left(0 - 1\right) + z\right)} - \log z\right) \]
      10. metadata-eval100.0%

        \[\leadsto x \cdot 0.5 - y \cdot \left(\left(\color{blue}{-1} + z\right) - \log z\right) \]
      11. +-commutative100.0%

        \[\leadsto x \cdot 0.5 - y \cdot \left(\color{blue}{\left(z + -1\right)} - \log z\right) \]
      12. associate--l+100.0%

        \[\leadsto x \cdot 0.5 - y \cdot \color{blue}{\left(z + \left(-1 - \log z\right)\right)} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{x \cdot 0.5 - y \cdot \left(z + \left(-1 - \log z\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in z around inf 89.3%

      \[\leadsto x \cdot 0.5 - \color{blue}{y \cdot z} \]

    if -5e-32 < (*.f64 x 1/2) < 5.0000000000000004e-16

    1. Initial program 99.8%

      \[x \cdot 0.5 + y \cdot \left(\left(1 - z\right) + \log z\right) \]
    2. Step-by-step derivation
      1. cancel-sign-sub99.8%

        \[\leadsto \color{blue}{x \cdot 0.5 - \left(-y\right) \cdot \left(\left(1 - z\right) + \log z\right)} \]
      2. *-commutative99.8%

        \[\leadsto x \cdot 0.5 - \color{blue}{\left(\left(1 - z\right) + \log z\right) \cdot \left(-y\right)} \]
      3. *-commutative99.8%

        \[\leadsto x \cdot 0.5 - \color{blue}{\left(-y\right) \cdot \left(\left(1 - z\right) + \log z\right)} \]
      4. distribute-lft-neg-out99.8%

        \[\leadsto x \cdot 0.5 - \color{blue}{\left(-y \cdot \left(\left(1 - z\right) + \log z\right)\right)} \]
      5. distribute-rgt-neg-in99.8%

        \[\leadsto x \cdot 0.5 - \color{blue}{y \cdot \left(-\left(\left(1 - z\right) + \log z\right)\right)} \]
      6. distribute-neg-in99.8%

        \[\leadsto x \cdot 0.5 - y \cdot \color{blue}{\left(\left(-\left(1 - z\right)\right) + \left(-\log z\right)\right)} \]
      7. unsub-neg99.8%

        \[\leadsto x \cdot 0.5 - y \cdot \color{blue}{\left(\left(-\left(1 - z\right)\right) - \log z\right)} \]
      8. neg-sub099.8%

        \[\leadsto x \cdot 0.5 - y \cdot \left(\color{blue}{\left(0 - \left(1 - z\right)\right)} - \log z\right) \]
      9. associate--r-99.8%

        \[\leadsto x \cdot 0.5 - y \cdot \left(\color{blue}{\left(\left(0 - 1\right) + z\right)} - \log z\right) \]
      10. metadata-eval99.8%

        \[\leadsto x \cdot 0.5 - y \cdot \left(\left(\color{blue}{-1} + z\right) - \log z\right) \]
      11. +-commutative99.8%

        \[\leadsto x \cdot 0.5 - y \cdot \left(\color{blue}{\left(z + -1\right)} - \log z\right) \]
      12. associate--l+99.8%

        \[\leadsto x \cdot 0.5 - y \cdot \color{blue}{\left(z + \left(-1 - \log z\right)\right)} \]
    3. Simplified99.8%

      \[\leadsto \color{blue}{x \cdot 0.5 - y \cdot \left(z + \left(-1 - \log z\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 90.0%

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

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

Alternative 3: 98.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq 1.04 \cdot 10^{-10}:\\ \;\;\;\;x \cdot 0.5 - y \cdot \left(-1 - \log z\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot 0.5 - y \cdot z\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= z 1.04e-10)
   (- (* x 0.5) (* y (- -1.0 (log z))))
   (- (* x 0.5) (* y z))))
double code(double x, double y, double z) {
	double tmp;
	if (z <= 1.04e-10) {
		tmp = (x * 0.5) - (y * (-1.0 - log(z)));
	} else {
		tmp = (x * 0.5) - (y * z);
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (z <= 1.04d-10) then
        tmp = (x * 0.5d0) - (y * ((-1.0d0) - log(z)))
    else
        tmp = (x * 0.5d0) - (y * z)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (z <= 1.04e-10) {
		tmp = (x * 0.5) - (y * (-1.0 - Math.log(z)));
	} else {
		tmp = (x * 0.5) - (y * z);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if z <= 1.04e-10:
		tmp = (x * 0.5) - (y * (-1.0 - math.log(z)))
	else:
		tmp = (x * 0.5) - (y * z)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (z <= 1.04e-10)
		tmp = Float64(Float64(x * 0.5) - Float64(y * Float64(-1.0 - log(z))));
	else
		tmp = Float64(Float64(x * 0.5) - Float64(y * z));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (z <= 1.04e-10)
		tmp = (x * 0.5) - (y * (-1.0 - log(z)));
	else
		tmp = (x * 0.5) - (y * z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[z, 1.04e-10], N[(N[(x * 0.5), $MachinePrecision] - N[(y * N[(-1.0 - N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 0.5), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.04 \cdot 10^{-10}:\\
\;\;\;\;x \cdot 0.5 - y \cdot \left(-1 - \log z\right)\\

\mathbf{else}:\\
\;\;\;\;x \cdot 0.5 - y \cdot z\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 1.04e-10

    1. Initial program 99.9%

      \[x \cdot 0.5 + y \cdot \left(\left(1 - z\right) + \log z\right) \]
    2. Step-by-step derivation
      1. cancel-sign-sub99.9%

        \[\leadsto \color{blue}{x \cdot 0.5 - \left(-y\right) \cdot \left(\left(1 - z\right) + \log z\right)} \]
      2. *-commutative99.9%

        \[\leadsto x \cdot 0.5 - \color{blue}{\left(\left(1 - z\right) + \log z\right) \cdot \left(-y\right)} \]
      3. *-commutative99.9%

        \[\leadsto x \cdot 0.5 - \color{blue}{\left(-y\right) \cdot \left(\left(1 - z\right) + \log z\right)} \]
      4. distribute-lft-neg-out99.9%

        \[\leadsto x \cdot 0.5 - \color{blue}{\left(-y \cdot \left(\left(1 - z\right) + \log z\right)\right)} \]
      5. distribute-rgt-neg-in99.9%

        \[\leadsto x \cdot 0.5 - \color{blue}{y \cdot \left(-\left(\left(1 - z\right) + \log z\right)\right)} \]
      6. distribute-neg-in99.9%

        \[\leadsto x \cdot 0.5 - y \cdot \color{blue}{\left(\left(-\left(1 - z\right)\right) + \left(-\log z\right)\right)} \]
      7. unsub-neg99.9%

        \[\leadsto x \cdot 0.5 - y \cdot \color{blue}{\left(\left(-\left(1 - z\right)\right) - \log z\right)} \]
      8. neg-sub099.9%

        \[\leadsto x \cdot 0.5 - y \cdot \left(\color{blue}{\left(0 - \left(1 - z\right)\right)} - \log z\right) \]
      9. associate--r-99.9%

        \[\leadsto x \cdot 0.5 - y \cdot \left(\color{blue}{\left(\left(0 - 1\right) + z\right)} - \log z\right) \]
      10. metadata-eval99.9%

        \[\leadsto x \cdot 0.5 - y \cdot \left(\left(\color{blue}{-1} + z\right) - \log z\right) \]
      11. +-commutative99.9%

        \[\leadsto x \cdot 0.5 - y \cdot \left(\color{blue}{\left(z + -1\right)} - \log z\right) \]
      12. associate--l+99.9%

        \[\leadsto x \cdot 0.5 - y \cdot \color{blue}{\left(z + \left(-1 - \log z\right)\right)} \]
    3. Simplified99.9%

      \[\leadsto \color{blue}{x \cdot 0.5 - y \cdot \left(z + \left(-1 - \log z\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in z around 0 99.7%

      \[\leadsto x \cdot 0.5 - \color{blue}{-1 \cdot \left(y \cdot \left(1 + \log z\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg99.7%

        \[\leadsto x \cdot 0.5 - \color{blue}{\left(-y \cdot \left(1 + \log z\right)\right)} \]
      2. distribute-rgt-neg-in99.7%

        \[\leadsto x \cdot 0.5 - \color{blue}{y \cdot \left(-\left(1 + \log z\right)\right)} \]
      3. mul-1-neg99.7%

        \[\leadsto x \cdot 0.5 - y \cdot \color{blue}{\left(-1 \cdot \left(1 + \log z\right)\right)} \]
      4. distribute-lft-in99.7%

        \[\leadsto x \cdot 0.5 - y \cdot \color{blue}{\left(-1 \cdot 1 + -1 \cdot \log z\right)} \]
      5. metadata-eval99.7%

        \[\leadsto x \cdot 0.5 - y \cdot \left(\color{blue}{-1} + -1 \cdot \log z\right) \]
      6. neg-mul-199.7%

        \[\leadsto x \cdot 0.5 - y \cdot \left(-1 + \color{blue}{\left(-\log z\right)}\right) \]
      7. sub-neg99.7%

        \[\leadsto x \cdot 0.5 - y \cdot \color{blue}{\left(-1 - \log z\right)} \]
    7. Simplified99.7%

      \[\leadsto x \cdot 0.5 - \color{blue}{y \cdot \left(-1 - \log z\right)} \]

    if 1.04e-10 < z

    1. Initial program 99.9%

      \[x \cdot 0.5 + y \cdot \left(\left(1 - z\right) + \log z\right) \]
    2. Step-by-step derivation
      1. cancel-sign-sub99.9%

        \[\leadsto \color{blue}{x \cdot 0.5 - \left(-y\right) \cdot \left(\left(1 - z\right) + \log z\right)} \]
      2. *-commutative99.9%

        \[\leadsto x \cdot 0.5 - \color{blue}{\left(\left(1 - z\right) + \log z\right) \cdot \left(-y\right)} \]
      3. *-commutative99.9%

        \[\leadsto x \cdot 0.5 - \color{blue}{\left(-y\right) \cdot \left(\left(1 - z\right) + \log z\right)} \]
      4. distribute-lft-neg-out99.9%

        \[\leadsto x \cdot 0.5 - \color{blue}{\left(-y \cdot \left(\left(1 - z\right) + \log z\right)\right)} \]
      5. distribute-rgt-neg-in99.9%

        \[\leadsto x \cdot 0.5 - \color{blue}{y \cdot \left(-\left(\left(1 - z\right) + \log z\right)\right)} \]
      6. distribute-neg-in99.9%

        \[\leadsto x \cdot 0.5 - y \cdot \color{blue}{\left(\left(-\left(1 - z\right)\right) + \left(-\log z\right)\right)} \]
      7. unsub-neg99.9%

        \[\leadsto x \cdot 0.5 - y \cdot \color{blue}{\left(\left(-\left(1 - z\right)\right) - \log z\right)} \]
      8. neg-sub099.9%

        \[\leadsto x \cdot 0.5 - y \cdot \left(\color{blue}{\left(0 - \left(1 - z\right)\right)} - \log z\right) \]
      9. associate--r-99.9%

        \[\leadsto x \cdot 0.5 - y \cdot \left(\color{blue}{\left(\left(0 - 1\right) + z\right)} - \log z\right) \]
      10. metadata-eval99.9%

        \[\leadsto x \cdot 0.5 - y \cdot \left(\left(\color{blue}{-1} + z\right) - \log z\right) \]
      11. +-commutative99.9%

        \[\leadsto x \cdot 0.5 - y \cdot \left(\color{blue}{\left(z + -1\right)} - \log z\right) \]
      12. associate--l+99.9%

        \[\leadsto x \cdot 0.5 - y \cdot \color{blue}{\left(z + \left(-1 - \log z\right)\right)} \]
    3. Simplified99.9%

      \[\leadsto \color{blue}{x \cdot 0.5 - y \cdot \left(z + \left(-1 - \log z\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in z around inf 98.4%

      \[\leadsto x \cdot 0.5 - \color{blue}{y \cdot z} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.0%

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

Alternative 4: 99.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ x \cdot 0.5 + y \cdot \left(\log z + \left(1 - z\right)\right) \end{array} \]
(FPCore (x y z) :precision binary64 (+ (* x 0.5) (* y (+ (log z) (- 1.0 z)))))
double code(double x, double y, double z) {
	return (x * 0.5) + (y * (log(z) + (1.0 - z)));
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (x * 0.5d0) + (y * (log(z) + (1.0d0 - z)))
end function
public static double code(double x, double y, double z) {
	return (x * 0.5) + (y * (Math.log(z) + (1.0 - z)));
}
def code(x, y, z):
	return (x * 0.5) + (y * (math.log(z) + (1.0 - z)))
function code(x, y, z)
	return Float64(Float64(x * 0.5) + Float64(y * Float64(log(z) + Float64(1.0 - z))))
end
function tmp = code(x, y, z)
	tmp = (x * 0.5) + (y * (log(z) + (1.0 - z)));
end
code[x_, y_, z_] := N[(N[(x * 0.5), $MachinePrecision] + N[(y * N[(N[Log[z], $MachinePrecision] + N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

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

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

Alternative 5: 60.0% accurate, 5.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq 95000000 \lor \neg \left(z \leq 9 \cdot 10^{+45}\right) \land z \leq 7.6 \cdot 10^{+73}:\\ \;\;\;\;x \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(-y\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= z 95000000.0) (and (not (<= z 9e+45)) (<= z 7.6e+73)))
   (* x 0.5)
   (* z (- y))))
double code(double x, double y, double z) {
	double tmp;
	if ((z <= 95000000.0) || (!(z <= 9e+45) && (z <= 7.6e+73))) {
		tmp = x * 0.5;
	} else {
		tmp = z * -y;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if ((z <= 95000000.0d0) .or. (.not. (z <= 9d+45)) .and. (z <= 7.6d+73)) then
        tmp = x * 0.5d0
    else
        tmp = z * -y
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if ((z <= 95000000.0) || (!(z <= 9e+45) && (z <= 7.6e+73))) {
		tmp = x * 0.5;
	} else {
		tmp = z * -y;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (z <= 95000000.0) or (not (z <= 9e+45) and (z <= 7.6e+73)):
		tmp = x * 0.5
	else:
		tmp = z * -y
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((z <= 95000000.0) || (!(z <= 9e+45) && (z <= 7.6e+73)))
		tmp = Float64(x * 0.5);
	else
		tmp = Float64(z * Float64(-y));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((z <= 95000000.0) || (~((z <= 9e+45)) && (z <= 7.6e+73)))
		tmp = x * 0.5;
	else
		tmp = z * -y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[z, 95000000.0], And[N[Not[LessEqual[z, 9e+45]], $MachinePrecision], LessEqual[z, 7.6e+73]]], N[(x * 0.5), $MachinePrecision], N[(z * (-y)), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq 95000000 \lor \neg \left(z \leq 9 \cdot 10^{+45}\right) \land z \leq 7.6 \cdot 10^{+73}:\\
\;\;\;\;x \cdot 0.5\\

\mathbf{else}:\\
\;\;\;\;z \cdot \left(-y\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 9.5e7 or 8.9999999999999997e45 < z < 7.60000000000000044e73

    1. Initial program 99.8%

      \[x \cdot 0.5 + y \cdot \left(\left(1 - z\right) + \log z\right) \]
    2. Step-by-step derivation
      1. cancel-sign-sub99.8%

        \[\leadsto \color{blue}{x \cdot 0.5 - \left(-y\right) \cdot \left(\left(1 - z\right) + \log z\right)} \]
      2. *-commutative99.8%

        \[\leadsto x \cdot 0.5 - \color{blue}{\left(\left(1 - z\right) + \log z\right) \cdot \left(-y\right)} \]
      3. *-commutative99.8%

        \[\leadsto x \cdot 0.5 - \color{blue}{\left(-y\right) \cdot \left(\left(1 - z\right) + \log z\right)} \]
      4. distribute-lft-neg-out99.8%

        \[\leadsto x \cdot 0.5 - \color{blue}{\left(-y \cdot \left(\left(1 - z\right) + \log z\right)\right)} \]
      5. distribute-rgt-neg-in99.8%

        \[\leadsto x \cdot 0.5 - \color{blue}{y \cdot \left(-\left(\left(1 - z\right) + \log z\right)\right)} \]
      6. distribute-neg-in99.8%

        \[\leadsto x \cdot 0.5 - y \cdot \color{blue}{\left(\left(-\left(1 - z\right)\right) + \left(-\log z\right)\right)} \]
      7. unsub-neg99.8%

        \[\leadsto x \cdot 0.5 - y \cdot \color{blue}{\left(\left(-\left(1 - z\right)\right) - \log z\right)} \]
      8. neg-sub099.8%

        \[\leadsto x \cdot 0.5 - y \cdot \left(\color{blue}{\left(0 - \left(1 - z\right)\right)} - \log z\right) \]
      9. associate--r-99.8%

        \[\leadsto x \cdot 0.5 - y \cdot \left(\color{blue}{\left(\left(0 - 1\right) + z\right)} - \log z\right) \]
      10. metadata-eval99.8%

        \[\leadsto x \cdot 0.5 - y \cdot \left(\left(\color{blue}{-1} + z\right) - \log z\right) \]
      11. +-commutative99.8%

        \[\leadsto x \cdot 0.5 - y \cdot \left(\color{blue}{\left(z + -1\right)} - \log z\right) \]
      12. associate--l+99.8%

        \[\leadsto x \cdot 0.5 - y \cdot \color{blue}{\left(z + \left(-1 - \log z\right)\right)} \]
    3. Simplified99.8%

      \[\leadsto \color{blue}{x \cdot 0.5 - y \cdot \left(z + \left(-1 - \log z\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 57.6%

      \[\leadsto \color{blue}{0.5 \cdot x} \]

    if 9.5e7 < z < 8.9999999999999997e45 or 7.60000000000000044e73 < z

    1. Initial program 100.0%

      \[x \cdot 0.5 + y \cdot \left(\left(1 - z\right) + \log z\right) \]
    2. Step-by-step derivation
      1. cancel-sign-sub100.0%

        \[\leadsto \color{blue}{x \cdot 0.5 - \left(-y\right) \cdot \left(\left(1 - z\right) + \log z\right)} \]
      2. *-commutative100.0%

        \[\leadsto x \cdot 0.5 - \color{blue}{\left(\left(1 - z\right) + \log z\right) \cdot \left(-y\right)} \]
      3. *-commutative100.0%

        \[\leadsto x \cdot 0.5 - \color{blue}{\left(-y\right) \cdot \left(\left(1 - z\right) + \log z\right)} \]
      4. distribute-lft-neg-out100.0%

        \[\leadsto x \cdot 0.5 - \color{blue}{\left(-y \cdot \left(\left(1 - z\right) + \log z\right)\right)} \]
      5. distribute-rgt-neg-in100.0%

        \[\leadsto x \cdot 0.5 - \color{blue}{y \cdot \left(-\left(\left(1 - z\right) + \log z\right)\right)} \]
      6. distribute-neg-in100.0%

        \[\leadsto x \cdot 0.5 - y \cdot \color{blue}{\left(\left(-\left(1 - z\right)\right) + \left(-\log z\right)\right)} \]
      7. unsub-neg100.0%

        \[\leadsto x \cdot 0.5 - y \cdot \color{blue}{\left(\left(-\left(1 - z\right)\right) - \log z\right)} \]
      8. neg-sub0100.0%

        \[\leadsto x \cdot 0.5 - y \cdot \left(\color{blue}{\left(0 - \left(1 - z\right)\right)} - \log z\right) \]
      9. associate--r-100.0%

        \[\leadsto x \cdot 0.5 - y \cdot \left(\color{blue}{\left(\left(0 - 1\right) + z\right)} - \log z\right) \]
      10. metadata-eval100.0%

        \[\leadsto x \cdot 0.5 - y \cdot \left(\left(\color{blue}{-1} + z\right) - \log z\right) \]
      11. +-commutative100.0%

        \[\leadsto x \cdot 0.5 - y \cdot \left(\color{blue}{\left(z + -1\right)} - \log z\right) \]
      12. associate--l+100.0%

        \[\leadsto x \cdot 0.5 - y \cdot \color{blue}{\left(z + \left(-1 - \log z\right)\right)} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{x \cdot 0.5 - y \cdot \left(z + \left(-1 - \log z\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in z around inf 75.4%

      \[\leadsto \color{blue}{-1 \cdot \left(y \cdot z\right)} \]
    6. Step-by-step derivation
      1. associate-*r*75.4%

        \[\leadsto \color{blue}{\left(-1 \cdot y\right) \cdot z} \]
      2. neg-mul-175.4%

        \[\leadsto \color{blue}{\left(-y\right)} \cdot z \]
    7. Simplified75.4%

      \[\leadsto \color{blue}{\left(-y\right) \cdot z} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification66.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 95000000 \lor \neg \left(z \leq 9 \cdot 10^{+45}\right) \land z \leq 7.6 \cdot 10^{+73}:\\ \;\;\;\;x \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(-y\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 75.5% accurate, 15.9× speedup?

\[\begin{array}{l} \\ x \cdot 0.5 - y \cdot z \end{array} \]
(FPCore (x y z) :precision binary64 (- (* x 0.5) (* y z)))
double code(double x, double y, double z) {
	return (x * 0.5) - (y * z);
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (x * 0.5d0) - (y * z)
end function
public static double code(double x, double y, double z) {
	return (x * 0.5) - (y * z);
}
def code(x, y, z):
	return (x * 0.5) - (y * z)
function code(x, y, z)
	return Float64(Float64(x * 0.5) - Float64(y * z))
end
function tmp = code(x, y, z)
	tmp = (x * 0.5) - (y * z);
end
code[x_, y_, z_] := N[(N[(x * 0.5), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

    \[x \cdot 0.5 + y \cdot \left(\left(1 - z\right) + \log z\right) \]
  2. Step-by-step derivation
    1. cancel-sign-sub99.9%

      \[\leadsto \color{blue}{x \cdot 0.5 - \left(-y\right) \cdot \left(\left(1 - z\right) + \log z\right)} \]
    2. *-commutative99.9%

      \[\leadsto x \cdot 0.5 - \color{blue}{\left(\left(1 - z\right) + \log z\right) \cdot \left(-y\right)} \]
    3. *-commutative99.9%

      \[\leadsto x \cdot 0.5 - \color{blue}{\left(-y\right) \cdot \left(\left(1 - z\right) + \log z\right)} \]
    4. distribute-lft-neg-out99.9%

      \[\leadsto x \cdot 0.5 - \color{blue}{\left(-y \cdot \left(\left(1 - z\right) + \log z\right)\right)} \]
    5. distribute-rgt-neg-in99.9%

      \[\leadsto x \cdot 0.5 - \color{blue}{y \cdot \left(-\left(\left(1 - z\right) + \log z\right)\right)} \]
    6. distribute-neg-in99.9%

      \[\leadsto x \cdot 0.5 - y \cdot \color{blue}{\left(\left(-\left(1 - z\right)\right) + \left(-\log z\right)\right)} \]
    7. unsub-neg99.9%

      \[\leadsto x \cdot 0.5 - y \cdot \color{blue}{\left(\left(-\left(1 - z\right)\right) - \log z\right)} \]
    8. neg-sub099.9%

      \[\leadsto x \cdot 0.5 - y \cdot \left(\color{blue}{\left(0 - \left(1 - z\right)\right)} - \log z\right) \]
    9. associate--r-99.9%

      \[\leadsto x \cdot 0.5 - y \cdot \left(\color{blue}{\left(\left(0 - 1\right) + z\right)} - \log z\right) \]
    10. metadata-eval99.9%

      \[\leadsto x \cdot 0.5 - y \cdot \left(\left(\color{blue}{-1} + z\right) - \log z\right) \]
    11. +-commutative99.9%

      \[\leadsto x \cdot 0.5 - y \cdot \left(\color{blue}{\left(z + -1\right)} - \log z\right) \]
    12. associate--l+99.9%

      \[\leadsto x \cdot 0.5 - y \cdot \color{blue}{\left(z + \left(-1 - \log z\right)\right)} \]
  3. Simplified99.9%

    \[\leadsto \color{blue}{x \cdot 0.5 - y \cdot \left(z + \left(-1 - \log z\right)\right)} \]
  4. Add Preprocessing
  5. Taylor expanded in z around inf 78.9%

    \[\leadsto x \cdot 0.5 - \color{blue}{y \cdot z} \]
  6. Final simplification78.9%

    \[\leadsto x \cdot 0.5 - y \cdot z \]
  7. Add Preprocessing

Alternative 7: 39.6% accurate, 37.0× speedup?

\[\begin{array}{l} \\ x \cdot 0.5 \end{array} \]
(FPCore (x y z) :precision binary64 (* x 0.5))
double code(double x, double y, double z) {
	return x * 0.5;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = x * 0.5d0
end function
public static double code(double x, double y, double z) {
	return x * 0.5;
}
def code(x, y, z):
	return x * 0.5
function code(x, y, z)
	return Float64(x * 0.5)
end
function tmp = code(x, y, z)
	tmp = x * 0.5;
end
code[x_, y_, z_] := N[(x * 0.5), $MachinePrecision]
\begin{array}{l}

\\
x \cdot 0.5
\end{array}
Derivation
  1. Initial program 99.9%

    \[x \cdot 0.5 + y \cdot \left(\left(1 - z\right) + \log z\right) \]
  2. Step-by-step derivation
    1. cancel-sign-sub99.9%

      \[\leadsto \color{blue}{x \cdot 0.5 - \left(-y\right) \cdot \left(\left(1 - z\right) + \log z\right)} \]
    2. *-commutative99.9%

      \[\leadsto x \cdot 0.5 - \color{blue}{\left(\left(1 - z\right) + \log z\right) \cdot \left(-y\right)} \]
    3. *-commutative99.9%

      \[\leadsto x \cdot 0.5 - \color{blue}{\left(-y\right) \cdot \left(\left(1 - z\right) + \log z\right)} \]
    4. distribute-lft-neg-out99.9%

      \[\leadsto x \cdot 0.5 - \color{blue}{\left(-y \cdot \left(\left(1 - z\right) + \log z\right)\right)} \]
    5. distribute-rgt-neg-in99.9%

      \[\leadsto x \cdot 0.5 - \color{blue}{y \cdot \left(-\left(\left(1 - z\right) + \log z\right)\right)} \]
    6. distribute-neg-in99.9%

      \[\leadsto x \cdot 0.5 - y \cdot \color{blue}{\left(\left(-\left(1 - z\right)\right) + \left(-\log z\right)\right)} \]
    7. unsub-neg99.9%

      \[\leadsto x \cdot 0.5 - y \cdot \color{blue}{\left(\left(-\left(1 - z\right)\right) - \log z\right)} \]
    8. neg-sub099.9%

      \[\leadsto x \cdot 0.5 - y \cdot \left(\color{blue}{\left(0 - \left(1 - z\right)\right)} - \log z\right) \]
    9. associate--r-99.9%

      \[\leadsto x \cdot 0.5 - y \cdot \left(\color{blue}{\left(\left(0 - 1\right) + z\right)} - \log z\right) \]
    10. metadata-eval99.9%

      \[\leadsto x \cdot 0.5 - y \cdot \left(\left(\color{blue}{-1} + z\right) - \log z\right) \]
    11. +-commutative99.9%

      \[\leadsto x \cdot 0.5 - y \cdot \left(\color{blue}{\left(z + -1\right)} - \log z\right) \]
    12. associate--l+99.9%

      \[\leadsto x \cdot 0.5 - y \cdot \color{blue}{\left(z + \left(-1 - \log z\right)\right)} \]
  3. Simplified99.9%

    \[\leadsto \color{blue}{x \cdot 0.5 - y \cdot \left(z + \left(-1 - \log z\right)\right)} \]
  4. Add Preprocessing
  5. Taylor expanded in x around inf 42.1%

    \[\leadsto \color{blue}{0.5 \cdot x} \]
  6. Final simplification42.1%

    \[\leadsto x \cdot 0.5 \]
  7. Add Preprocessing

Developer target: 99.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(y + 0.5 \cdot x\right) - y \cdot \left(z - \log z\right) \end{array} \]
(FPCore (x y z) :precision binary64 (- (+ y (* 0.5 x)) (* y (- z (log z)))))
double code(double x, double y, double z) {
	return (y + (0.5 * x)) - (y * (z - log(z)));
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (y + (0.5d0 * x)) - (y * (z - log(z)))
end function
public static double code(double x, double y, double z) {
	return (y + (0.5 * x)) - (y * (z - Math.log(z)));
}
def code(x, y, z):
	return (y + (0.5 * x)) - (y * (z - math.log(z)))
function code(x, y, z)
	return Float64(Float64(y + Float64(0.5 * x)) - Float64(y * Float64(z - log(z))))
end
function tmp = code(x, y, z)
	tmp = (y + (0.5 * x)) - (y * (z - log(z)));
end
code[x_, y_, z_] := N[(N[(y + N[(0.5 * x), $MachinePrecision]), $MachinePrecision] - N[(y * N[(z - N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

Reproduce

?
herbie shell --seed 2024048 
(FPCore (x y z)
  :name "System.Random.MWC.Distributions:gamma from mwc-random-0.13.3.2"
  :precision binary64

  :alt
  (- (+ y (* 0.5 x)) (* y (- z (log z))))

  (+ (* x 0.5) (* y (+ (- 1.0 z) (log z)))))