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

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

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

Alternative 2: 83.6% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
t_0 := x \cdot 0.5 - y \cdot z\\
\mathbf{if}\;x \cdot 0.5 \leq -1 \cdot 10^{-41}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \cdot 0.5 \leq 5 \cdot 10^{-175}:\\
\;\;\;\;y \cdot \left(\left(\log z - z\right) + 1\right)\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x #s(literal 1/2 binary64)) < -1.00000000000000001e-41 or 5e-175 < (*.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. Step-by-step derivation
      1. +-lowering-+.f64N/A

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{*.f64}\left(y, \left(\left(\log z + 1\right) - \color{blue}{z}\right)\right)\right) \]
      6. --lowering--.f64N/A

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(\left(1 + \log z\right), z\right)\right)\right) \]
      8. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \log z\right), z\right)\right)\right) \]
      9. log-lowering-log.f6499.9%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{log.f64}\left(z\right)\right), z\right)\right)\right) \]
    3. Simplified99.9%

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \left(y \cdot \frac{1}{\color{blue}{\frac{\left(1 + \log z\right) + z}{\left(1 + \log z\right) \cdot \left(1 + \log z\right) - z \cdot z}}}\right)\right) \]
      3. un-div-invN/A

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{/.f64}\left(y, \left(\frac{1}{\color{blue}{\frac{\left(1 + \log z\right) \cdot \left(1 + \log z\right) - z \cdot z}{\left(1 + \log z\right) + z}}}\right)\right)\right) \]
      6. flip--N/A

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{/.f64}\left(y, \mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(\left(1 + \log z\right), \color{blue}{z}\right)\right)\right)\right) \]
      9. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{/.f64}\left(y, \mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \log z\right), z\right)\right)\right)\right) \]
      10. log-lowering-log.f6499.9%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{/.f64}\left(y, \mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{log.f64}\left(z\right)\right), z\right)\right)\right)\right) \]
    6. Applied egg-rr99.9%

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

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{/.f64}\left(y, \color{blue}{\left(\frac{-1}{z}\right)}\right)\right) \]
    8. Step-by-step derivation
      1. /-lowering-/.f6487.1%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{/.f64}\left(y, \mathsf{/.f64}\left(-1, \color{blue}{z}\right)\right)\right) \]
    9. Simplified87.1%

      \[\leadsto x \cdot 0.5 + \frac{y}{\color{blue}{\frac{-1}{z}}} \]
    10. Taylor expanded in x around 0

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

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

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

        \[\leadsto \frac{1}{2} \cdot x - \color{blue}{y \cdot z} \]
      4. --lowering--.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\left(\frac{1}{2} \cdot x\right), \color{blue}{\left(y \cdot z\right)}\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, x\right), \left(\color{blue}{y} \cdot z\right)\right) \]
      6. *-lowering-*.f6487.2%

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, x\right), \mathsf{*.f64}\left(y, \color{blue}{z}\right)\right) \]
    12. Simplified87.2%

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

    if -1.00000000000000001e-41 < (*.f64 x #s(literal 1/2 binary64)) < 5e-175

    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. +-lowering-+.f64N/A

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{*.f64}\left(y, \left(\left(\log z + 1\right) - \color{blue}{z}\right)\right)\right) \]
      6. --lowering--.f64N/A

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(\left(1 + \log z\right), z\right)\right)\right) \]
      8. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \log z\right), z\right)\right)\right) \]
      9. log-lowering-log.f6499.8%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{log.f64}\left(z\right)\right), z\right)\right)\right) \]
    3. Simplified99.8%

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

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

        \[\leadsto \mathsf{*.f64}\left(y, \color{blue}{\left(\left(1 + \log z\right) - z\right)}\right) \]
      2. associate--l+N/A

        \[\leadsto \mathsf{*.f64}\left(y, \left(1 + \color{blue}{\left(\log z - z\right)}\right)\right) \]
      3. sub-negN/A

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

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

        \[\leadsto \mathsf{*.f64}\left(y, \left(1 + 1 \cdot \color{blue}{\left(\log z + -1 \cdot z\right)}\right)\right) \]
      6. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(y, \left(1 + \left(\mathsf{neg}\left(-1\right)\right) \cdot \left(\color{blue}{\log z} + -1 \cdot z\right)\right)\right) \]
      7. cancel-sign-sub-invN/A

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

        \[\leadsto \mathsf{*.f64}\left(y, \left(1 - \left(\mathsf{neg}\left(\left(\log z + -1 \cdot z\right)\right)\right)\right)\right) \]
      9. --lowering--.f64N/A

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

        \[\leadsto \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(1, \left(\mathsf{neg}\left(\left(\log z + \left(\mathsf{neg}\left(z\right)\right)\right)\right)\right)\right)\right) \]
      11. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(1, \left(\mathsf{neg}\left(\left(\left(\mathsf{neg}\left(z\right)\right) + \log z\right)\right)\right)\right)\right) \]
      12. distribute-neg-inN/A

        \[\leadsto \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(1, \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(z\right)\right)\right)\right) + \color{blue}{\left(\mathsf{neg}\left(\log z\right)\right)}\right)\right)\right) \]
      13. remove-double-negN/A

        \[\leadsto \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(1, \left(z + \left(\mathsf{neg}\left(\color{blue}{\log z}\right)\right)\right)\right)\right) \]
      14. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(1, \left(z - \color{blue}{\log z}\right)\right)\right) \]
      15. --lowering--.f64N/A

        \[\leadsto \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(1, \mathsf{\_.f64}\left(z, \color{blue}{\log z}\right)\right)\right) \]
      16. log-lowering-log.f6487.8%

        \[\leadsto \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(1, \mathsf{\_.f64}\left(z, \mathsf{log.f64}\left(z\right)\right)\right)\right) \]
    7. Simplified87.8%

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

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

Alternative 3: 98.7% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq 0.27:\\
\;\;\;\;x \cdot 0.5 + y \cdot \left(\log z + 1\right)\\

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


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

    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. +-lowering-+.f64N/A

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{*.f64}\left(y, \left(\left(\log z + 1\right) - \color{blue}{z}\right)\right)\right) \]
      6. --lowering--.f64N/A

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(\left(1 + \log z\right), z\right)\right)\right) \]
      8. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \log z\right), z\right)\right)\right) \]
      9. log-lowering-log.f6499.8%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{log.f64}\left(z\right)\right), z\right)\right)\right) \]
    3. Simplified99.8%

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

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \color{blue}{\left(y \cdot \left(1 + \log z\right)\right)}\right) \]
    6. Step-by-step derivation
      1. *-lowering-*.f64N/A

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{*.f64}\left(y, \mathsf{+.f64}\left(1, \color{blue}{\log z}\right)\right)\right) \]
      3. log-lowering-log.f6499.1%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{*.f64}\left(y, \mathsf{+.f64}\left(1, \mathsf{log.f64}\left(z\right)\right)\right)\right) \]
    7. Simplified99.1%

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

    if 0.27000000000000002 < 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. +-lowering-+.f64N/A

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{*.f64}\left(y, \left(\left(\log z + 1\right) - \color{blue}{z}\right)\right)\right) \]
      6. --lowering--.f64N/A

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(\left(1 + \log z\right), z\right)\right)\right) \]
      8. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \log z\right), z\right)\right)\right) \]
      9. log-lowering-log.f64100.0%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{log.f64}\left(z\right)\right), z\right)\right)\right) \]
    3. Simplified100.0%

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \left(y \cdot \frac{1}{\color{blue}{\frac{\left(1 + \log z\right) + z}{\left(1 + \log z\right) \cdot \left(1 + \log z\right) - z \cdot z}}}\right)\right) \]
      3. un-div-invN/A

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{/.f64}\left(y, \left(\frac{1}{\color{blue}{\frac{\left(1 + \log z\right) \cdot \left(1 + \log z\right) - z \cdot z}{\left(1 + \log z\right) + z}}}\right)\right)\right) \]
      6. flip--N/A

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{/.f64}\left(y, \mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(\left(1 + \log z\right), \color{blue}{z}\right)\right)\right)\right) \]
      9. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{/.f64}\left(y, \mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \log z\right), z\right)\right)\right)\right) \]
      10. log-lowering-log.f6499.9%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{/.f64}\left(y, \mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{log.f64}\left(z\right)\right), z\right)\right)\right)\right) \]
    6. Applied egg-rr99.9%

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

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{/.f64}\left(y, \color{blue}{\left(\frac{-1}{z}\right)}\right)\right) \]
    8. Step-by-step derivation
      1. /-lowering-/.f6498.4%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{/.f64}\left(y, \mathsf{/.f64}\left(-1, \color{blue}{z}\right)\right)\right) \]
    9. Simplified98.4%

      \[\leadsto x \cdot 0.5 + \frac{y}{\color{blue}{\frac{-1}{z}}} \]
    10. Taylor expanded in x around 0

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

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

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

        \[\leadsto \frac{1}{2} \cdot x - \color{blue}{y \cdot z} \]
      4. --lowering--.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\left(\frac{1}{2} \cdot x\right), \color{blue}{\left(y \cdot z\right)}\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, x\right), \left(\color{blue}{y} \cdot z\right)\right) \]
      6. *-lowering-*.f6498.6%

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, x\right), \mathsf{*.f64}\left(y, \color{blue}{z}\right)\right) \]
    12. Simplified98.6%

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

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

Alternative 4: 58.0% accurate, 11.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq 6.2 \cdot 10^{+72}:\\
\;\;\;\;x \cdot 0.5\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 6.19999999999999977e72

    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. +-lowering-+.f64N/A

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{*.f64}\left(y, \left(\left(\log z + 1\right) - \color{blue}{z}\right)\right)\right) \]
      6. --lowering--.f64N/A

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(\left(1 + \log z\right), z\right)\right)\right) \]
      8. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \log z\right), z\right)\right)\right) \]
      9. log-lowering-log.f6499.8%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{log.f64}\left(z\right)\right), z\right)\right)\right) \]
    3. Simplified99.8%

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

      \[\leadsto \color{blue}{\frac{1}{2} \cdot x} \]
    6. Step-by-step derivation
      1. *-lowering-*.f6454.7%

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \color{blue}{x}\right) \]
    7. Simplified54.7%

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

    if 6.19999999999999977e72 < 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. +-lowering-+.f64N/A

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{*.f64}\left(y, \left(\left(\log z + 1\right) - \color{blue}{z}\right)\right)\right) \]
      6. --lowering--.f64N/A

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(\left(1 + \log z\right), z\right)\right)\right) \]
      8. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \log z\right), z\right)\right)\right) \]
      9. log-lowering-log.f64100.0%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{log.f64}\left(z\right)\right), z\right)\right)\right) \]
    3. Simplified100.0%

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

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

        \[\leadsto \mathsf{*.f64}\left(y, \color{blue}{\left(\left(1 + \log z\right) - z\right)}\right) \]
      2. associate--l+N/A

        \[\leadsto \mathsf{*.f64}\left(y, \left(1 + \color{blue}{\left(\log z - z\right)}\right)\right) \]
      3. sub-negN/A

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

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

        \[\leadsto \mathsf{*.f64}\left(y, \left(1 + 1 \cdot \color{blue}{\left(\log z + -1 \cdot z\right)}\right)\right) \]
      6. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(y, \left(1 + \left(\mathsf{neg}\left(-1\right)\right) \cdot \left(\color{blue}{\log z} + -1 \cdot z\right)\right)\right) \]
      7. cancel-sign-sub-invN/A

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

        \[\leadsto \mathsf{*.f64}\left(y, \left(1 - \left(\mathsf{neg}\left(\left(\log z + -1 \cdot z\right)\right)\right)\right)\right) \]
      9. --lowering--.f64N/A

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

        \[\leadsto \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(1, \left(\mathsf{neg}\left(\left(\log z + \left(\mathsf{neg}\left(z\right)\right)\right)\right)\right)\right)\right) \]
      11. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(1, \left(\mathsf{neg}\left(\left(\left(\mathsf{neg}\left(z\right)\right) + \log z\right)\right)\right)\right)\right) \]
      12. distribute-neg-inN/A

        \[\leadsto \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(1, \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(z\right)\right)\right)\right) + \color{blue}{\left(\mathsf{neg}\left(\log z\right)\right)}\right)\right)\right) \]
      13. remove-double-negN/A

        \[\leadsto \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(1, \left(z + \left(\mathsf{neg}\left(\color{blue}{\log z}\right)\right)\right)\right)\right) \]
      14. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(1, \left(z - \color{blue}{\log z}\right)\right)\right) \]
      15. --lowering--.f64N/A

        \[\leadsto \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(1, \mathsf{\_.f64}\left(z, \color{blue}{\log z}\right)\right)\right) \]
      16. log-lowering-log.f6468.1%

        \[\leadsto \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(1, \mathsf{\_.f64}\left(z, \mathsf{log.f64}\left(z\right)\right)\right)\right) \]
    7. Simplified68.1%

      \[\leadsto \color{blue}{y \cdot \left(1 - \left(z - \log z\right)\right)} \]
    8. Taylor expanded in z around inf

      \[\leadsto \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(1, \color{blue}{z}\right)\right) \]
    9. Step-by-step derivation
      1. Simplified68.1%

        \[\leadsto y \cdot \left(1 - \color{blue}{z}\right) \]
    10. Recombined 2 regimes into one program.
    11. Final simplification59.5%

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

    Alternative 5: 73.9% 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. +-lowering-+.f64N/A

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{*.f64}\left(y, \left(\left(\log z + 1\right) - \color{blue}{z}\right)\right)\right) \]
      6. --lowering--.f64N/A

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(\left(1 + \log z\right), z\right)\right)\right) \]
      8. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \log z\right), z\right)\right)\right) \]
      9. log-lowering-log.f6499.9%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{log.f64}\left(z\right)\right), z\right)\right)\right) \]
    3. Simplified99.9%

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \left(y \cdot \frac{1}{\color{blue}{\frac{\left(1 + \log z\right) + z}{\left(1 + \log z\right) \cdot \left(1 + \log z\right) - z \cdot z}}}\right)\right) \]
      3. un-div-invN/A

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{/.f64}\left(y, \left(\frac{1}{\color{blue}{\frac{\left(1 + \log z\right) \cdot \left(1 + \log z\right) - z \cdot z}{\left(1 + \log z\right) + z}}}\right)\right)\right) \]
      6. flip--N/A

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{/.f64}\left(y, \mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(\left(1 + \log z\right), \color{blue}{z}\right)\right)\right)\right) \]
      9. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{/.f64}\left(y, \mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \log z\right), z\right)\right)\right)\right) \]
      10. log-lowering-log.f6499.9%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{/.f64}\left(y, \mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{log.f64}\left(z\right)\right), z\right)\right)\right)\right) \]
    6. Applied egg-rr99.9%

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

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{/.f64}\left(y, \color{blue}{\left(\frac{-1}{z}\right)}\right)\right) \]
    8. Step-by-step derivation
      1. /-lowering-/.f6476.7%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{/.f64}\left(y, \mathsf{/.f64}\left(-1, \color{blue}{z}\right)\right)\right) \]
    9. Simplified76.7%

      \[\leadsto x \cdot 0.5 + \frac{y}{\color{blue}{\frac{-1}{z}}} \]
    10. Taylor expanded in x around 0

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

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

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

        \[\leadsto \frac{1}{2} \cdot x - \color{blue}{y \cdot z} \]
      4. --lowering--.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\left(\frac{1}{2} \cdot x\right), \color{blue}{\left(y \cdot z\right)}\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, x\right), \left(\color{blue}{y} \cdot z\right)\right) \]
      6. *-lowering-*.f6476.8%

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, x\right), \mathsf{*.f64}\left(y, \color{blue}{z}\right)\right) \]
    12. Simplified76.8%

      \[\leadsto \color{blue}{0.5 \cdot x - y \cdot z} \]
    13. Final simplification76.8%

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

    Alternative 6: 39.2% 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. +-lowering-+.f64N/A

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{*.f64}\left(y, \left(\left(\log z + 1\right) - \color{blue}{z}\right)\right)\right) \]
      6. --lowering--.f64N/A

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(\left(1 + \log z\right), z\right)\right)\right) \]
      8. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \log z\right), z\right)\right)\right) \]
      9. log-lowering-log.f6499.9%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{log.f64}\left(z\right)\right), z\right)\right)\right) \]
    3. Simplified99.9%

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

      \[\leadsto \color{blue}{\frac{1}{2} \cdot x} \]
    6. Step-by-step derivation
      1. *-lowering-*.f6447.1%

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \color{blue}{x}\right) \]
    7. Simplified47.1%

      \[\leadsto \color{blue}{0.5 \cdot x} \]
    8. Final simplification47.1%

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

    Alternative 7: 1.8% accurate, 111.0× speedup?

    \[\begin{array}{l} \\ y \end{array} \]
    (FPCore (x y z) :precision binary64 y)
    double code(double x, double y, double z) {
    	return y;
    }
    
    real(8) function code(x, y, z)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        real(8), intent (in) :: z
        code = y
    end function
    
    public static double code(double x, double y, double z) {
    	return y;
    }
    
    def code(x, y, z):
    	return y
    
    function code(x, y, z)
    	return y
    end
    
    function tmp = code(x, y, z)
    	tmp = y;
    end
    
    code[x_, y_, z_] := y
    
    \begin{array}{l}
    
    \\
    y
    \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. +-lowering-+.f64N/A

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{*.f64}\left(y, \left(\left(\log z + 1\right) - \color{blue}{z}\right)\right)\right) \]
      6. --lowering--.f64N/A

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(\left(1 + \log z\right), z\right)\right)\right) \]
      8. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \log z\right), z\right)\right)\right) \]
      9. log-lowering-log.f6499.9%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, \mathsf{log.f64}\left(z\right)\right), z\right)\right)\right) \]
    3. Simplified99.9%

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

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

        \[\leadsto \mathsf{*.f64}\left(y, \color{blue}{\left(\left(1 + \log z\right) - z\right)}\right) \]
      2. associate--l+N/A

        \[\leadsto \mathsf{*.f64}\left(y, \left(1 + \color{blue}{\left(\log z - z\right)}\right)\right) \]
      3. sub-negN/A

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

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

        \[\leadsto \mathsf{*.f64}\left(y, \left(1 + 1 \cdot \color{blue}{\left(\log z + -1 \cdot z\right)}\right)\right) \]
      6. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(y, \left(1 + \left(\mathsf{neg}\left(-1\right)\right) \cdot \left(\color{blue}{\log z} + -1 \cdot z\right)\right)\right) \]
      7. cancel-sign-sub-invN/A

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

        \[\leadsto \mathsf{*.f64}\left(y, \left(1 - \left(\mathsf{neg}\left(\left(\log z + -1 \cdot z\right)\right)\right)\right)\right) \]
      9. --lowering--.f64N/A

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

        \[\leadsto \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(1, \left(\mathsf{neg}\left(\left(\log z + \left(\mathsf{neg}\left(z\right)\right)\right)\right)\right)\right)\right) \]
      11. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(1, \left(\mathsf{neg}\left(\left(\left(\mathsf{neg}\left(z\right)\right) + \log z\right)\right)\right)\right)\right) \]
      12. distribute-neg-inN/A

        \[\leadsto \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(1, \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(z\right)\right)\right)\right) + \color{blue}{\left(\mathsf{neg}\left(\log z\right)\right)}\right)\right)\right) \]
      13. remove-double-negN/A

        \[\leadsto \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(1, \left(z + \left(\mathsf{neg}\left(\color{blue}{\log z}\right)\right)\right)\right)\right) \]
      14. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(1, \left(z - \color{blue}{\log z}\right)\right)\right) \]
      15. --lowering--.f64N/A

        \[\leadsto \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(1, \mathsf{\_.f64}\left(z, \color{blue}{\log z}\right)\right)\right) \]
      16. log-lowering-log.f6453.8%

        \[\leadsto \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(1, \mathsf{\_.f64}\left(z, \mathsf{log.f64}\left(z\right)\right)\right)\right) \]
    7. Simplified53.8%

      \[\leadsto \color{blue}{y \cdot \left(1 - \left(z - \log z\right)\right)} \]
    8. Taylor expanded in z around inf

      \[\leadsto \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(1, \color{blue}{z}\right)\right) \]
    9. Step-by-step derivation
      1. Simplified31.4%

        \[\leadsto y \cdot \left(1 - \color{blue}{z}\right) \]
      2. Taylor expanded in z around 0

        \[\leadsto \color{blue}{y} \]
      3. Step-by-step derivation
        1. Simplified2.1%

          \[\leadsto \color{blue}{y} \]
        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 2024158 
        (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)))))