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

Percentage Accurate: 99.9% → 99.9%
Time: 9.0s
Alternatives: 7
Speedup: N/A×

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.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(\log z - z, y, \mathsf{fma}\left(0.5, x, y\right)\right) \end{array} \]
(FPCore (x y z) :precision binary64 (fma (- (log z) z) y (fma 0.5 x y)))
double code(double x, double y, double z) {
	return fma((log(z) - z), y, fma(0.5, x, y));
}
function code(x, y, z)
	return fma(Float64(log(z) - z), y, fma(0.5, x, y))
end
code[x_, y_, z_] := N[(N[(N[Log[z], $MachinePrecision] - z), $MachinePrecision] * y + N[(0.5 * x + y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(\log z - z, y, \mathsf{fma}\left(0.5, x, y\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. Taylor expanded in x around 0

    \[\leadsto \color{blue}{\frac{1}{2} \cdot x + y \cdot \left(\left(1 + \log z\right) - z\right)} \]
  4. Step-by-step derivation
    1. sub-negN/A

      \[\leadsto \frac{1}{2} \cdot x + y \cdot \color{blue}{\left(\left(1 + \log z\right) + \left(\mathsf{neg}\left(z\right)\right)\right)} \]
    2. associate-+r+N/A

      \[\leadsto \frac{1}{2} \cdot x + y \cdot \color{blue}{\left(1 + \left(\log z + \left(\mathsf{neg}\left(z\right)\right)\right)\right)} \]
    3. mul-1-negN/A

      \[\leadsto \frac{1}{2} \cdot x + y \cdot \left(1 + \left(\log z + \color{blue}{-1 \cdot z}\right)\right) \]
    4. distribute-lft-inN/A

      \[\leadsto \frac{1}{2} \cdot x + \color{blue}{\left(y \cdot 1 + y \cdot \left(\log z + -1 \cdot z\right)\right)} \]
    5. *-rgt-identityN/A

      \[\leadsto \frac{1}{2} \cdot x + \left(\color{blue}{y} + y \cdot \left(\log z + -1 \cdot z\right)\right) \]
    6. associate-+r+N/A

      \[\leadsto \color{blue}{\left(\frac{1}{2} \cdot x + y\right) + y \cdot \left(\log z + -1 \cdot z\right)} \]
    7. +-commutativeN/A

      \[\leadsto \color{blue}{y \cdot \left(\log z + -1 \cdot z\right) + \left(\frac{1}{2} \cdot x + y\right)} \]
    8. *-commutativeN/A

      \[\leadsto \color{blue}{\left(\log z + -1 \cdot z\right) \cdot y} + \left(\frac{1}{2} \cdot x + y\right) \]
    9. lower-fma.f64N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left(\log z + -1 \cdot z, y, \frac{1}{2} \cdot x + y\right)} \]
    10. mul-1-negN/A

      \[\leadsto \mathsf{fma}\left(\log z + \color{blue}{\left(\mathsf{neg}\left(z\right)\right)}, y, \frac{1}{2} \cdot x + y\right) \]
    11. sub-negN/A

      \[\leadsto \mathsf{fma}\left(\color{blue}{\log z - z}, y, \frac{1}{2} \cdot x + y\right) \]
    12. lower--.f64N/A

      \[\leadsto \mathsf{fma}\left(\color{blue}{\log z - z}, y, \frac{1}{2} \cdot x + y\right) \]
    13. lower-log.f64N/A

      \[\leadsto \mathsf{fma}\left(\color{blue}{\log z} - z, y, \frac{1}{2} \cdot x + y\right) \]
    14. lower-fma.f6499.9

      \[\leadsto \mathsf{fma}\left(\log z - z, y, \color{blue}{\mathsf{fma}\left(0.5, x, y\right)}\right) \]
  5. Applied rewrites99.9%

    \[\leadsto \color{blue}{\mathsf{fma}\left(\log z - z, y, \mathsf{fma}\left(0.5, x, y\right)\right)} \]
  6. Add Preprocessing

Alternative 2: 83.4% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \cdot 0.5 \leq -1 \cdot 10^{+101} \lor \neg \left(x \cdot 0.5 \leq 5 \cdot 10^{-100}\right):\\ \;\;\;\;\mathsf{fma}\left(-z, y, 0.5 \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\log z - z, y, y\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= (* x 0.5) -1e+101) (not (<= (* x 0.5) 5e-100)))
   (fma (- z) y (* 0.5 x))
   (fma (- (log z) z) y y)))
double code(double x, double y, double z) {
	double tmp;
	if (((x * 0.5) <= -1e+101) || !((x * 0.5) <= 5e-100)) {
		tmp = fma(-z, y, (0.5 * x));
	} else {
		tmp = fma((log(z) - z), y, y);
	}
	return tmp;
}
function code(x, y, z)
	tmp = 0.0
	if ((Float64(x * 0.5) <= -1e+101) || !(Float64(x * 0.5) <= 5e-100))
		tmp = fma(Float64(-z), y, Float64(0.5 * x));
	else
		tmp = fma(Float64(log(z) - z), y, y);
	end
	return tmp
end
code[x_, y_, z_] := If[Or[LessEqual[N[(x * 0.5), $MachinePrecision], -1e+101], N[Not[LessEqual[N[(x * 0.5), $MachinePrecision], 5e-100]], $MachinePrecision]], N[((-z) * y + N[(0.5 * x), $MachinePrecision]), $MachinePrecision], N[(N[(N[Log[z], $MachinePrecision] - z), $MachinePrecision] * y + y), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \cdot 0.5 \leq -1 \cdot 10^{+101} \lor \neg \left(x \cdot 0.5 \leq 5 \cdot 10^{-100}\right):\\
\;\;\;\;\mathsf{fma}\left(-z, y, 0.5 \cdot x\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\log z - z, y, y\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x #s(literal 1/2 binary64)) < -9.9999999999999998e100 or 5.0000000000000001e-100 < (*.f64 x #s(literal 1/2 binary64))

    1. Initial program 99.9%

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

      \[\leadsto x \cdot \frac{1}{2} + y \cdot \color{blue}{\left(-1 \cdot z\right)} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto x \cdot \frac{1}{2} + y \cdot \color{blue}{\left(\mathsf{neg}\left(z\right)\right)} \]
      2. lower-neg.f6486.3

        \[\leadsto x \cdot 0.5 + y \cdot \color{blue}{\left(-z\right)} \]
    5. Applied rewrites86.3%

      \[\leadsto x \cdot 0.5 + y \cdot \color{blue}{\left(-z\right)} \]
    6. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \color{blue}{x \cdot \frac{1}{2} + y \cdot \left(-z\right)} \]
      2. +-commutativeN/A

        \[\leadsto \color{blue}{y \cdot \left(-z\right) + x \cdot \frac{1}{2}} \]
      3. lift-*.f64N/A

        \[\leadsto \color{blue}{y \cdot \left(-z\right)} + x \cdot \frac{1}{2} \]
      4. *-commutativeN/A

        \[\leadsto \color{blue}{\left(-z\right) \cdot y} + x \cdot \frac{1}{2} \]
      5. lift-*.f64N/A

        \[\leadsto \left(-z\right) \cdot y + \color{blue}{x \cdot \frac{1}{2}} \]
      6. *-commutativeN/A

        \[\leadsto \left(-z\right) \cdot y + \color{blue}{\frac{1}{2} \cdot x} \]
      7. lift-*.f64N/A

        \[\leadsto \left(-z\right) \cdot y + \color{blue}{\frac{1}{2} \cdot x} \]
      8. lower-fma.f6486.3

        \[\leadsto \color{blue}{\mathsf{fma}\left(-z, y, 0.5 \cdot x\right)} \]
    7. Applied rewrites86.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(-z, y, 0.5 \cdot x\right)} \]

    if -9.9999999999999998e100 < (*.f64 x #s(literal 1/2 binary64)) < 5.0000000000000001e-100

    1. Initial program 99.8%

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

      \[\leadsto \color{blue}{y \cdot \left(\left(1 + \log z\right) - z\right)} \]
    4. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto y \cdot \color{blue}{\left(\left(1 + \log z\right) + \left(\mathsf{neg}\left(z\right)\right)\right)} \]
      2. associate-+r+N/A

        \[\leadsto y \cdot \color{blue}{\left(1 + \left(\log z + \left(\mathsf{neg}\left(z\right)\right)\right)\right)} \]
      3. mul-1-negN/A

        \[\leadsto y \cdot \left(1 + \left(\log z + \color{blue}{-1 \cdot z}\right)\right) \]
      4. +-commutativeN/A

        \[\leadsto y \cdot \color{blue}{\left(\left(\log z + -1 \cdot z\right) + 1\right)} \]
      5. distribute-rgt-inN/A

        \[\leadsto \color{blue}{\left(\log z + -1 \cdot z\right) \cdot y + 1 \cdot y} \]
      6. *-lft-identityN/A

        \[\leadsto \left(\log z + -1 \cdot z\right) \cdot y + \color{blue}{y} \]
      7. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\log z + -1 \cdot z, y, y\right)} \]
      8. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(\log z + \color{blue}{\left(\mathsf{neg}\left(z\right)\right)}, y, y\right) \]
      9. sub-negN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\log z - z}, y, y\right) \]
      10. lower--.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\log z - z}, y, y\right) \]
      11. lower-log.f6490.0

        \[\leadsto \mathsf{fma}\left(\color{blue}{\log z} - z, y, y\right) \]
    5. Applied rewrites90.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\log z - z, y, y\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification88.3%

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

Alternative 3: 61.1% accurate, 1.0× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;0.5 \cdot x\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 (-.f64 #s(literal 1 binary64) z) (log.f64 z)) < -1e15

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{-1 \cdot \left(y \cdot z\right)} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \color{blue}{\mathsf{neg}\left(y \cdot z\right)} \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{neg}\left(\color{blue}{z \cdot y}\right) \]
      3. distribute-lft-neg-inN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(z\right)\right) \cdot y} \]
      4. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(z\right)\right) \cdot y} \]
      5. lower-neg.f6473.9

        \[\leadsto \color{blue}{\left(-z\right)} \cdot y \]
    5. Applied rewrites73.9%

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

    if -1e15 < (+.f64 (-.f64 #s(literal 1 binary64) z) (log.f64 z))

    1. Initial program 99.8%

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

      \[\leadsto \color{blue}{\frac{1}{2} \cdot x + y \cdot \left(\left(1 + \log z\right) - z\right)} \]
    4. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \frac{1}{2} \cdot x + y \cdot \color{blue}{\left(\left(1 + \log z\right) + \left(\mathsf{neg}\left(z\right)\right)\right)} \]
      2. associate-+r+N/A

        \[\leadsto \frac{1}{2} \cdot x + y \cdot \color{blue}{\left(1 + \left(\log z + \left(\mathsf{neg}\left(z\right)\right)\right)\right)} \]
      3. mul-1-negN/A

        \[\leadsto \frac{1}{2} \cdot x + y \cdot \left(1 + \left(\log z + \color{blue}{-1 \cdot z}\right)\right) \]
      4. distribute-lft-inN/A

        \[\leadsto \frac{1}{2} \cdot x + \color{blue}{\left(y \cdot 1 + y \cdot \left(\log z + -1 \cdot z\right)\right)} \]
      5. *-rgt-identityN/A

        \[\leadsto \frac{1}{2} \cdot x + \left(\color{blue}{y} + y \cdot \left(\log z + -1 \cdot z\right)\right) \]
      6. associate-+r+N/A

        \[\leadsto \color{blue}{\left(\frac{1}{2} \cdot x + y\right) + y \cdot \left(\log z + -1 \cdot z\right)} \]
      7. +-commutativeN/A

        \[\leadsto \color{blue}{y \cdot \left(\log z + -1 \cdot z\right) + \left(\frac{1}{2} \cdot x + y\right)} \]
      8. *-commutativeN/A

        \[\leadsto \color{blue}{\left(\log z + -1 \cdot z\right) \cdot y} + \left(\frac{1}{2} \cdot x + y\right) \]
      9. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\log z + -1 \cdot z, y, \frac{1}{2} \cdot x + y\right)} \]
      10. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(\log z + \color{blue}{\left(\mathsf{neg}\left(z\right)\right)}, y, \frac{1}{2} \cdot x + y\right) \]
      11. sub-negN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\log z - z}, y, \frac{1}{2} \cdot x + y\right) \]
      12. lower--.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\log z - z}, y, \frac{1}{2} \cdot x + y\right) \]
      13. lower-log.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\log z} - z, y, \frac{1}{2} \cdot x + y\right) \]
      14. lower-fma.f6499.8

        \[\leadsto \mathsf{fma}\left(\log z - z, y, \color{blue}{\mathsf{fma}\left(0.5, x, y\right)}\right) \]
    5. Applied rewrites99.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\log z - z, y, \mathsf{fma}\left(0.5, x, y\right)\right)} \]
    6. Taylor expanded in x around inf

      \[\leadsto \color{blue}{x \cdot \left(\frac{1}{2} + \frac{y \cdot \left(\left(1 + \log z\right) - z\right)}{x}\right)} \]
    7. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{\left(\frac{1}{2} + \frac{y \cdot \left(\left(1 + \log z\right) - z\right)}{x}\right) \cdot x} \]
      2. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(\frac{1}{2} + \frac{y \cdot \left(\left(1 + \log z\right) - z\right)}{x}\right) \cdot x} \]
      3. +-commutativeN/A

        \[\leadsto \color{blue}{\left(\frac{y \cdot \left(\left(1 + \log z\right) - z\right)}{x} + \frac{1}{2}\right)} \cdot x \]
      4. associate-/l*N/A

        \[\leadsto \left(\color{blue}{y \cdot \frac{\left(1 + \log z\right) - z}{x}} + \frac{1}{2}\right) \cdot x \]
      5. *-commutativeN/A

        \[\leadsto \left(\color{blue}{\frac{\left(1 + \log z\right) - z}{x} \cdot y} + \frac{1}{2}\right) \cdot x \]
      6. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\left(1 + \log z\right) - z}{x}, y, \frac{1}{2}\right)} \cdot x \]
      7. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{\left(1 + \log z\right) - z}{x}}, y, \frac{1}{2}\right) \cdot x \]
      8. lower--.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{\left(1 + \log z\right) - z}}{x}, y, \frac{1}{2}\right) \cdot x \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{\left(\log z + 1\right)} - z}{x}, y, \frac{1}{2}\right) \cdot x \]
      10. lower-+.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{\left(\log z + 1\right)} - z}{x}, y, \frac{1}{2}\right) \cdot x \]
      11. lower-log.f6485.3

        \[\leadsto \mathsf{fma}\left(\frac{\left(\color{blue}{\log z} + 1\right) - z}{x}, y, 0.5\right) \cdot x \]
    8. Applied rewrites85.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\left(\log z + 1\right) - z}{x}, y, 0.5\right) \cdot x} \]
    9. Taylor expanded in x around inf

      \[\leadsto \frac{1}{2} \cdot x \]
    10. Step-by-step derivation
      1. Applied rewrites44.4%

        \[\leadsto 0.5 \cdot x \]
    11. Recombined 2 regimes into one program.
    12. Add Preprocessing

    Alternative 4: 98.8% accurate, 1.0× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq 0.28:\\ \;\;\;\;\mathsf{fma}\left(0.5, x, \mathsf{fma}\left(\log z, y, y\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-z, y, 0.5 \cdot x\right)\\ \end{array} \end{array} \]
    (FPCore (x y z)
     :precision binary64
     (if (<= z 0.28) (fma 0.5 x (fma (log z) y y)) (fma (- z) y (* 0.5 x))))
    double code(double x, double y, double z) {
    	double tmp;
    	if (z <= 0.28) {
    		tmp = fma(0.5, x, fma(log(z), y, y));
    	} else {
    		tmp = fma(-z, y, (0.5 * x));
    	}
    	return tmp;
    }
    
    function code(x, y, z)
    	tmp = 0.0
    	if (z <= 0.28)
    		tmp = fma(0.5, x, fma(log(z), y, y));
    	else
    		tmp = fma(Float64(-z), y, Float64(0.5 * x));
    	end
    	return tmp
    end
    
    code[x_, y_, z_] := If[LessEqual[z, 0.28], N[(0.5 * x + N[(N[Log[z], $MachinePrecision] * y + y), $MachinePrecision]), $MachinePrecision], N[((-z) * y + N[(0.5 * x), $MachinePrecision]), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;z \leq 0.28:\\
    \;\;\;\;\mathsf{fma}\left(0.5, x, \mathsf{fma}\left(\log z, y, y\right)\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;\mathsf{fma}\left(-z, y, 0.5 \cdot x\right)\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if z < 0.28000000000000003

      1. Initial program 99.8%

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

        \[\leadsto \color{blue}{\frac{1}{2} \cdot x + y \cdot \left(1 + \log z\right)} \]
      4. Step-by-step derivation
        1. lower-fma.f64N/A

          \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{2}, x, y \cdot \left(1 + \log z\right)\right)} \]
        2. +-commutativeN/A

          \[\leadsto \mathsf{fma}\left(\frac{1}{2}, x, y \cdot \color{blue}{\left(\log z + 1\right)}\right) \]
        3. distribute-rgt-inN/A

          \[\leadsto \mathsf{fma}\left(\frac{1}{2}, x, \color{blue}{\log z \cdot y + 1 \cdot y}\right) \]
        4. *-lft-identityN/A

          \[\leadsto \mathsf{fma}\left(\frac{1}{2}, x, \log z \cdot y + \color{blue}{y}\right) \]
        5. lower-fma.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{1}{2}, x, \color{blue}{\mathsf{fma}\left(\log z, y, y\right)}\right) \]
        6. lower-log.f6498.8

          \[\leadsto \mathsf{fma}\left(0.5, x, \mathsf{fma}\left(\color{blue}{\log z}, y, y\right)\right) \]
      5. Applied rewrites98.8%

        \[\leadsto \color{blue}{\mathsf{fma}\left(0.5, x, \mathsf{fma}\left(\log z, y, y\right)\right)} \]

      if 0.28000000000000003 < z

      1. Initial program 100.0%

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

        \[\leadsto x \cdot \frac{1}{2} + y \cdot \color{blue}{\left(-1 \cdot z\right)} \]
      4. Step-by-step derivation
        1. mul-1-negN/A

          \[\leadsto x \cdot \frac{1}{2} + y \cdot \color{blue}{\left(\mathsf{neg}\left(z\right)\right)} \]
        2. lower-neg.f6498.7

          \[\leadsto x \cdot 0.5 + y \cdot \color{blue}{\left(-z\right)} \]
      5. Applied rewrites98.7%

        \[\leadsto x \cdot 0.5 + y \cdot \color{blue}{\left(-z\right)} \]
      6. Step-by-step derivation
        1. lift-+.f64N/A

          \[\leadsto \color{blue}{x \cdot \frac{1}{2} + y \cdot \left(-z\right)} \]
        2. +-commutativeN/A

          \[\leadsto \color{blue}{y \cdot \left(-z\right) + x \cdot \frac{1}{2}} \]
        3. lift-*.f64N/A

          \[\leadsto \color{blue}{y \cdot \left(-z\right)} + x \cdot \frac{1}{2} \]
        4. *-commutativeN/A

          \[\leadsto \color{blue}{\left(-z\right) \cdot y} + x \cdot \frac{1}{2} \]
        5. lift-*.f64N/A

          \[\leadsto \left(-z\right) \cdot y + \color{blue}{x \cdot \frac{1}{2}} \]
        6. *-commutativeN/A

          \[\leadsto \left(-z\right) \cdot y + \color{blue}{\frac{1}{2} \cdot x} \]
        7. lift-*.f64N/A

          \[\leadsto \left(-z\right) \cdot y + \color{blue}{\frac{1}{2} \cdot x} \]
        8. lower-fma.f6498.7

          \[\leadsto \color{blue}{\mathsf{fma}\left(-z, y, 0.5 \cdot x\right)} \]
      7. Applied rewrites98.7%

        \[\leadsto \color{blue}{\mathsf{fma}\left(-z, y, 0.5 \cdot x\right)} \]
    3. Recombined 2 regimes into one program.
    4. Add Preprocessing

    Alternative 5: 75.3% accurate, 1.1× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq 3.15 \cdot 10^{-31}:\\ \;\;\;\;\mathsf{fma}\left(\log z, y, y\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-z, y, 0.5 \cdot x\right)\\ \end{array} \end{array} \]
    (FPCore (x y z)
     :precision binary64
     (if (<= z 3.15e-31) (fma (log z) y y) (fma (- z) y (* 0.5 x))))
    double code(double x, double y, double z) {
    	double tmp;
    	if (z <= 3.15e-31) {
    		tmp = fma(log(z), y, y);
    	} else {
    		tmp = fma(-z, y, (0.5 * x));
    	}
    	return tmp;
    }
    
    function code(x, y, z)
    	tmp = 0.0
    	if (z <= 3.15e-31)
    		tmp = fma(log(z), y, y);
    	else
    		tmp = fma(Float64(-z), y, Float64(0.5 * x));
    	end
    	return tmp
    end
    
    code[x_, y_, z_] := If[LessEqual[z, 3.15e-31], N[(N[Log[z], $MachinePrecision] * y + y), $MachinePrecision], N[((-z) * y + N[(0.5 * x), $MachinePrecision]), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;z \leq 3.15 \cdot 10^{-31}:\\
    \;\;\;\;\mathsf{fma}\left(\log z, y, y\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;\mathsf{fma}\left(-z, y, 0.5 \cdot x\right)\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if z < 3.1500000000000001e-31

      1. Initial program 99.8%

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

        \[\leadsto \color{blue}{\frac{1}{2} \cdot x + y \cdot \left(1 + \log z\right)} \]
      4. Step-by-step derivation
        1. lower-fma.f64N/A

          \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{2}, x, y \cdot \left(1 + \log z\right)\right)} \]
        2. +-commutativeN/A

          \[\leadsto \mathsf{fma}\left(\frac{1}{2}, x, y \cdot \color{blue}{\left(\log z + 1\right)}\right) \]
        3. distribute-rgt-inN/A

          \[\leadsto \mathsf{fma}\left(\frac{1}{2}, x, \color{blue}{\log z \cdot y + 1 \cdot y}\right) \]
        4. *-lft-identityN/A

          \[\leadsto \mathsf{fma}\left(\frac{1}{2}, x, \log z \cdot y + \color{blue}{y}\right) \]
        5. lower-fma.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{1}{2}, x, \color{blue}{\mathsf{fma}\left(\log z, y, y\right)}\right) \]
        6. lower-log.f6499.8

          \[\leadsto \mathsf{fma}\left(0.5, x, \mathsf{fma}\left(\color{blue}{\log z}, y, y\right)\right) \]
      5. Applied rewrites99.8%

        \[\leadsto \color{blue}{\mathsf{fma}\left(0.5, x, \mathsf{fma}\left(\log z, y, y\right)\right)} \]
      6. Taylor expanded in x around 0

        \[\leadsto y + \color{blue}{y \cdot \log z} \]
      7. Step-by-step derivation
        1. Applied rewrites60.1%

          \[\leadsto \mathsf{fma}\left(\log z, \color{blue}{y}, y\right) \]

        if 3.1500000000000001e-31 < z

        1. Initial program 100.0%

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

          \[\leadsto x \cdot \frac{1}{2} + y \cdot \color{blue}{\left(-1 \cdot z\right)} \]
        4. Step-by-step derivation
          1. mul-1-negN/A

            \[\leadsto x \cdot \frac{1}{2} + y \cdot \color{blue}{\left(\mathsf{neg}\left(z\right)\right)} \]
          2. lower-neg.f6497.4

            \[\leadsto x \cdot 0.5 + y \cdot \color{blue}{\left(-z\right)} \]
        5. Applied rewrites97.4%

          \[\leadsto x \cdot 0.5 + y \cdot \color{blue}{\left(-z\right)} \]
        6. Step-by-step derivation
          1. lift-+.f64N/A

            \[\leadsto \color{blue}{x \cdot \frac{1}{2} + y \cdot \left(-z\right)} \]
          2. +-commutativeN/A

            \[\leadsto \color{blue}{y \cdot \left(-z\right) + x \cdot \frac{1}{2}} \]
          3. lift-*.f64N/A

            \[\leadsto \color{blue}{y \cdot \left(-z\right)} + x \cdot \frac{1}{2} \]
          4. *-commutativeN/A

            \[\leadsto \color{blue}{\left(-z\right) \cdot y} + x \cdot \frac{1}{2} \]
          5. lift-*.f64N/A

            \[\leadsto \left(-z\right) \cdot y + \color{blue}{x \cdot \frac{1}{2}} \]
          6. *-commutativeN/A

            \[\leadsto \left(-z\right) \cdot y + \color{blue}{\frac{1}{2} \cdot x} \]
          7. lift-*.f64N/A

            \[\leadsto \left(-z\right) \cdot y + \color{blue}{\frac{1}{2} \cdot x} \]
          8. lower-fma.f6497.5

            \[\leadsto \color{blue}{\mathsf{fma}\left(-z, y, 0.5 \cdot x\right)} \]
        7. Applied rewrites97.5%

          \[\leadsto \color{blue}{\mathsf{fma}\left(-z, y, 0.5 \cdot x\right)} \]
      8. Recombined 2 regimes into one program.
      9. Add Preprocessing

      Alternative 6: 75.2% accurate, 8.6× speedup?

      \[\begin{array}{l} \\ \mathsf{fma}\left(-z, y, 0.5 \cdot x\right) \end{array} \]
      (FPCore (x y z) :precision binary64 (fma (- z) y (* 0.5 x)))
      double code(double x, double y, double z) {
      	return fma(-z, y, (0.5 * x));
      }
      
      function code(x, y, z)
      	return fma(Float64(-z), y, Float64(0.5 * x))
      end
      
      code[x_, y_, z_] := N[((-z) * y + N[(0.5 * x), $MachinePrecision]), $MachinePrecision]
      
      \begin{array}{l}
      
      \\
      \mathsf{fma}\left(-z, y, 0.5 \cdot x\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. Taylor expanded in z around inf

        \[\leadsto x \cdot \frac{1}{2} + y \cdot \color{blue}{\left(-1 \cdot z\right)} \]
      4. Step-by-step derivation
        1. mul-1-negN/A

          \[\leadsto x \cdot \frac{1}{2} + y \cdot \color{blue}{\left(\mathsf{neg}\left(z\right)\right)} \]
        2. lower-neg.f6470.9

          \[\leadsto x \cdot 0.5 + y \cdot \color{blue}{\left(-z\right)} \]
      5. Applied rewrites70.9%

        \[\leadsto x \cdot 0.5 + y \cdot \color{blue}{\left(-z\right)} \]
      6. Step-by-step derivation
        1. lift-+.f64N/A

          \[\leadsto \color{blue}{x \cdot \frac{1}{2} + y \cdot \left(-z\right)} \]
        2. +-commutativeN/A

          \[\leadsto \color{blue}{y \cdot \left(-z\right) + x \cdot \frac{1}{2}} \]
        3. lift-*.f64N/A

          \[\leadsto \color{blue}{y \cdot \left(-z\right)} + x \cdot \frac{1}{2} \]
        4. *-commutativeN/A

          \[\leadsto \color{blue}{\left(-z\right) \cdot y} + x \cdot \frac{1}{2} \]
        5. lift-*.f64N/A

          \[\leadsto \left(-z\right) \cdot y + \color{blue}{x \cdot \frac{1}{2}} \]
        6. *-commutativeN/A

          \[\leadsto \left(-z\right) \cdot y + \color{blue}{\frac{1}{2} \cdot x} \]
        7. lift-*.f64N/A

          \[\leadsto \left(-z\right) \cdot y + \color{blue}{\frac{1}{2} \cdot x} \]
        8. lower-fma.f6471.0

          \[\leadsto \color{blue}{\mathsf{fma}\left(-z, y, 0.5 \cdot x\right)} \]
      7. Applied rewrites71.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(-z, y, 0.5 \cdot x\right)} \]
      8. Add Preprocessing

      Alternative 7: 40.0% accurate, 20.0× speedup?

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

        \[\leadsto \color{blue}{\frac{1}{2} \cdot x + y \cdot \left(\left(1 + \log z\right) - z\right)} \]
      4. Step-by-step derivation
        1. sub-negN/A

          \[\leadsto \frac{1}{2} \cdot x + y \cdot \color{blue}{\left(\left(1 + \log z\right) + \left(\mathsf{neg}\left(z\right)\right)\right)} \]
        2. associate-+r+N/A

          \[\leadsto \frac{1}{2} \cdot x + y \cdot \color{blue}{\left(1 + \left(\log z + \left(\mathsf{neg}\left(z\right)\right)\right)\right)} \]
        3. mul-1-negN/A

          \[\leadsto \frac{1}{2} \cdot x + y \cdot \left(1 + \left(\log z + \color{blue}{-1 \cdot z}\right)\right) \]
        4. distribute-lft-inN/A

          \[\leadsto \frac{1}{2} \cdot x + \color{blue}{\left(y \cdot 1 + y \cdot \left(\log z + -1 \cdot z\right)\right)} \]
        5. *-rgt-identityN/A

          \[\leadsto \frac{1}{2} \cdot x + \left(\color{blue}{y} + y \cdot \left(\log z + -1 \cdot z\right)\right) \]
        6. associate-+r+N/A

          \[\leadsto \color{blue}{\left(\frac{1}{2} \cdot x + y\right) + y \cdot \left(\log z + -1 \cdot z\right)} \]
        7. +-commutativeN/A

          \[\leadsto \color{blue}{y \cdot \left(\log z + -1 \cdot z\right) + \left(\frac{1}{2} \cdot x + y\right)} \]
        8. *-commutativeN/A

          \[\leadsto \color{blue}{\left(\log z + -1 \cdot z\right) \cdot y} + \left(\frac{1}{2} \cdot x + y\right) \]
        9. lower-fma.f64N/A

          \[\leadsto \color{blue}{\mathsf{fma}\left(\log z + -1 \cdot z, y, \frac{1}{2} \cdot x + y\right)} \]
        10. mul-1-negN/A

          \[\leadsto \mathsf{fma}\left(\log z + \color{blue}{\left(\mathsf{neg}\left(z\right)\right)}, y, \frac{1}{2} \cdot x + y\right) \]
        11. sub-negN/A

          \[\leadsto \mathsf{fma}\left(\color{blue}{\log z - z}, y, \frac{1}{2} \cdot x + y\right) \]
        12. lower--.f64N/A

          \[\leadsto \mathsf{fma}\left(\color{blue}{\log z - z}, y, \frac{1}{2} \cdot x + y\right) \]
        13. lower-log.f64N/A

          \[\leadsto \mathsf{fma}\left(\color{blue}{\log z} - z, y, \frac{1}{2} \cdot x + y\right) \]
        14. lower-fma.f6499.9

          \[\leadsto \mathsf{fma}\left(\log z - z, y, \color{blue}{\mathsf{fma}\left(0.5, x, y\right)}\right) \]
      5. Applied rewrites99.9%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\log z - z, y, \mathsf{fma}\left(0.5, x, y\right)\right)} \]
      6. Taylor expanded in x around inf

        \[\leadsto \color{blue}{x \cdot \left(\frac{1}{2} + \frac{y \cdot \left(\left(1 + \log z\right) - z\right)}{x}\right)} \]
      7. Step-by-step derivation
        1. *-commutativeN/A

          \[\leadsto \color{blue}{\left(\frac{1}{2} + \frac{y \cdot \left(\left(1 + \log z\right) - z\right)}{x}\right) \cdot x} \]
        2. lower-*.f64N/A

          \[\leadsto \color{blue}{\left(\frac{1}{2} + \frac{y \cdot \left(\left(1 + \log z\right) - z\right)}{x}\right) \cdot x} \]
        3. +-commutativeN/A

          \[\leadsto \color{blue}{\left(\frac{y \cdot \left(\left(1 + \log z\right) - z\right)}{x} + \frac{1}{2}\right)} \cdot x \]
        4. associate-/l*N/A

          \[\leadsto \left(\color{blue}{y \cdot \frac{\left(1 + \log z\right) - z}{x}} + \frac{1}{2}\right) \cdot x \]
        5. *-commutativeN/A

          \[\leadsto \left(\color{blue}{\frac{\left(1 + \log z\right) - z}{x} \cdot y} + \frac{1}{2}\right) \cdot x \]
        6. lower-fma.f64N/A

          \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\left(1 + \log z\right) - z}{x}, y, \frac{1}{2}\right)} \cdot x \]
        7. lower-/.f64N/A

          \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{\left(1 + \log z\right) - z}{x}}, y, \frac{1}{2}\right) \cdot x \]
        8. lower--.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{\left(1 + \log z\right) - z}}{x}, y, \frac{1}{2}\right) \cdot x \]
        9. +-commutativeN/A

          \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{\left(\log z + 1\right)} - z}{x}, y, \frac{1}{2}\right) \cdot x \]
        10. lower-+.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{\left(\log z + 1\right)} - z}{x}, y, \frac{1}{2}\right) \cdot x \]
        11. lower-log.f6481.4

          \[\leadsto \mathsf{fma}\left(\frac{\left(\color{blue}{\log z} + 1\right) - z}{x}, y, 0.5\right) \cdot x \]
      8. Applied rewrites81.4%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\left(\log z + 1\right) - z}{x}, y, 0.5\right) \cdot x} \]
      9. Taylor expanded in x around inf

        \[\leadsto \frac{1}{2} \cdot x \]
      10. Step-by-step derivation
        1. Applied rewrites36.2%

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

        Developer Target 1: 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 2024313 
        (FPCore (x y z)
          :name "System.Random.MWC.Distributions:gamma from mwc-random-0.13.3.2"
          :precision binary64
        
          :alt
          (! :herbie-platform default (- (+ y (* 1/2 x)) (* y (- z (log z)))))
        
          (+ (* x 0.5) (* y (+ (- 1.0 z) (log z)))))