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

Percentage Accurate: 99.9% → 99.9%
Time: 14.1s
Alternatives: 11
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 11 alternatives:

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

Initial Program: 99.9% accurate, 1.0× speedup?

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

\\
y \cdot \left(\left(\log z + 1\right) - z\right) + 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. Add Preprocessing
  3. Step-by-step derivation
    1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

Alternative 2: 74.8% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot 0.5 - y \cdot z\\ \mathbf{if}\;z \leq 1.85 \cdot 10^{-253}:\\ \;\;\;\;y \cdot \left(\log z + 1\right)\\ \mathbf{elif}\;z \leq 6.5 \cdot 10^{-167}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 5.1 \cdot 10^{-139}:\\ \;\;\;\;y + y \cdot \log z\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (- (* x 0.5) (* y z))))
   (if (<= z 1.85e-253)
     (* y (+ (log z) 1.0))
     (if (<= z 6.5e-167) t_0 (if (<= z 5.1e-139) (+ y (* y (log z))) t_0)))))
double code(double x, double y, double z) {
	double t_0 = (x * 0.5) - (y * z);
	double tmp;
	if (z <= 1.85e-253) {
		tmp = y * (log(z) + 1.0);
	} else if (z <= 6.5e-167) {
		tmp = t_0;
	} else if (z <= 5.1e-139) {
		tmp = y + (y * log(z));
	} 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 (z <= 1.85d-253) then
        tmp = y * (log(z) + 1.0d0)
    else if (z <= 6.5d-167) then
        tmp = t_0
    else if (z <= 5.1d-139) then
        tmp = y + (y * log(z))
    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 (z <= 1.85e-253) {
		tmp = y * (Math.log(z) + 1.0);
	} else if (z <= 6.5e-167) {
		tmp = t_0;
	} else if (z <= 5.1e-139) {
		tmp = y + (y * Math.log(z));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = (x * 0.5) - (y * z)
	tmp = 0
	if z <= 1.85e-253:
		tmp = y * (math.log(z) + 1.0)
	elif z <= 6.5e-167:
		tmp = t_0
	elif z <= 5.1e-139:
		tmp = y + (y * math.log(z))
	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 (z <= 1.85e-253)
		tmp = Float64(y * Float64(log(z) + 1.0));
	elseif (z <= 6.5e-167)
		tmp = t_0;
	elseif (z <= 5.1e-139)
		tmp = Float64(y + Float64(y * log(z)));
	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 (z <= 1.85e-253)
		tmp = y * (log(z) + 1.0);
	elseif (z <= 6.5e-167)
		tmp = t_0;
	elseif (z <= 5.1e-139)
		tmp = y + (y * log(z));
	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[z, 1.85e-253], N[(y * N[(N[Log[z], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.5e-167], t$95$0, If[LessEqual[z, 5.1e-139], N[(y + N[(y * N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq 6.5 \cdot 10^{-167}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq 5.1 \cdot 10^{-139}:\\
\;\;\;\;y + y \cdot \log z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < 1.84999999999999988e-253

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

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

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

        \[\leadsto \mathsf{*.f64}\left(y, \left(1 + \color{blue}{\left(\log z + \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. +-lowering-+.f64N/A

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(y, \mathsf{+.f64}\left(1, \mathsf{\_.f64}\left(\mathsf{log.f64}\left(z\right), z\right)\right)\right) \]
    5. Simplified63.2%

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(y, \mathsf{+.f64}\left(1, \mathsf{log.f64}\left(z\right)\right)\right) \]
    8. Simplified63.2%

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

    if 1.84999999999999988e-253 < z < 6.49999999999999973e-167 or 5.10000000000000036e-139 < z

    1. Initial program 99.9%

      \[x \cdot 0.5 + y \cdot \left(\left(1 - z\right) + \log z\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-+l-N/A

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{*.f64}\left(y, \left(\frac{1 \cdot 1 - \left(z - \log z\right) \cdot \left(z - \log z\right)}{\color{blue}{1 + \left(z - \log z\right)}}\right)\right)\right) \]
      3. 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{1 + \left(z - \log z\right)}{1 \cdot 1 - \left(z - \log z\right) \cdot \left(z - \log z\right)}}}\right)\right)\right) \]
      4. /-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(\frac{1 + \left(z - \log z\right)}{1 \cdot 1 - \left(z - \log z\right) \cdot \left(z - \log z\right)}\right)}\right)\right)\right) \]
      5. /-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 + \left(z - \log z\right)\right), \color{blue}{\left(1 \cdot 1 - \left(z - \log z\right) \cdot \left(z - \log z\right)\right)}\right)\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(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \left(z - \log z\right)\right), \left(\color{blue}{1 \cdot 1} - \left(z - \log z\right) \cdot \left(z - \log z\right)\right)\right)\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, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{\_.f64}\left(z, \log z\right)\right), \left(1 \cdot \color{blue}{1} - \left(z - \log z\right) \cdot \left(z - \log z\right)\right)\right)\right)\right)\right) \]
      8. log-lowering-log.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, \mathsf{\_.f64}\left(z, \mathsf{log.f64}\left(z\right)\right)\right), \left(1 \cdot 1 - \left(z - \log z\right) \cdot \left(z - \log z\right)\right)\right)\right)\right)\right) \]
      9. metadata-evalN/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, \mathsf{\_.f64}\left(z, \mathsf{log.f64}\left(z\right)\right)\right), \left(1 - \color{blue}{\left(z - \log z\right)} \cdot \left(z - \log z\right)\right)\right)\right)\right)\right) \]
      10. --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, \mathsf{\_.f64}\left(z, \mathsf{log.f64}\left(z\right)\right)\right), \mathsf{\_.f64}\left(1, \color{blue}{\left(\left(z - \log z\right) \cdot \left(z - \log z\right)\right)}\right)\right)\right)\right)\right) \]
      11. pow2N/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, \mathsf{\_.f64}\left(z, \mathsf{log.f64}\left(z\right)\right)\right), \mathsf{\_.f64}\left(1, \left({\left(z - \log z\right)}^{\color{blue}{2}}\right)\right)\right)\right)\right)\right) \]
      12. pow-lowering-pow.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, \mathsf{\_.f64}\left(z, \mathsf{log.f64}\left(z\right)\right)\right), \mathsf{\_.f64}\left(1, \mathsf{pow.f64}\left(\left(z - \log z\right), \color{blue}{2}\right)\right)\right)\right)\right)\right) \]
      13. --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, \mathsf{\_.f64}\left(z, \mathsf{log.f64}\left(z\right)\right)\right), \mathsf{\_.f64}\left(1, \mathsf{pow.f64}\left(\mathsf{\_.f64}\left(z, \log z\right), 2\right)\right)\right)\right)\right)\right) \]
      14. log-lowering-log.f6477.5%

        \[\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{\_.f64}\left(z, \mathsf{log.f64}\left(z\right)\right)\right), \mathsf{\_.f64}\left(1, \mathsf{pow.f64}\left(\mathsf{\_.f64}\left(z, \mathsf{log.f64}\left(z\right)\right), 2\right)\right)\right)\right)\right)\right) \]
    4. Applied egg-rr77.5%

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(y \cdot z\right) + \frac{1}{2} \cdot x} \]
    9. 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. *-commutativeN/A

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

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

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

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

    if 6.49999999999999973e-167 < z < 5.10000000000000036e-139

    1. Initial program 99.7%

      \[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. *-lowering-*.f64N/A

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

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

        \[\leadsto \mathsf{*.f64}\left(y, \left(1 + \color{blue}{\left(\log z + \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. +-lowering-+.f64N/A

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(y, \mathsf{+.f64}\left(1, \mathsf{\_.f64}\left(\mathsf{log.f64}\left(z\right), z\right)\right)\right) \]
    5. Simplified80.2%

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(y, \mathsf{+.f64}\left(1, \mathsf{log.f64}\left(z\right)\right)\right) \]
    8. Simplified80.2%

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

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

        \[\leadsto \log z \cdot y + \color{blue}{1 \cdot y} \]
      3. *-lft-identityN/A

        \[\leadsto \log z \cdot y + y \]
      4. +-lowering-+.f64N/A

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\log z, y\right), y\right) \]
      6. log-lowering-log.f6480.2%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{log.f64}\left(z\right), y\right), y\right) \]
    10. Applied egg-rr80.2%

      \[\leadsto \color{blue}{\log z \cdot y + y} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification84.4%

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

Alternative 3: 74.8% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
t_0 := y \cdot \left(\log z + 1\right)\\
t_1 := x \cdot 0.5 - y \cdot z\\
\mathbf{if}\;z \leq 1.05 \cdot 10^{-251}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq 1.15 \cdot 10^{-166}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq 2.2 \cdot 10^{-139}:\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 1.04999999999999991e-251 or 1.14999999999999999e-166 < z < 2.2000000000000001e-139

    1. Initial program 99.7%

      \[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. *-lowering-*.f64N/A

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

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

        \[\leadsto \mathsf{*.f64}\left(y, \left(1 + \color{blue}{\left(\log z + \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. +-lowering-+.f64N/A

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(y, \mathsf{+.f64}\left(1, \mathsf{log.f64}\left(z\right)\right)\right) \]
    8. Simplified71.5%

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

    if 1.04999999999999991e-251 < z < 1.14999999999999999e-166 or 2.2000000000000001e-139 < z

    1. Initial program 99.9%

      \[x \cdot 0.5 + y \cdot \left(\left(1 - z\right) + \log z\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-+l-N/A

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{*.f64}\left(y, \left(\frac{1 \cdot 1 - \left(z - \log z\right) \cdot \left(z - \log z\right)}{\color{blue}{1 + \left(z - \log z\right)}}\right)\right)\right) \]
      3. 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{1 + \left(z - \log z\right)}{1 \cdot 1 - \left(z - \log z\right) \cdot \left(z - \log z\right)}}}\right)\right)\right) \]
      4. /-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(\frac{1 + \left(z - \log z\right)}{1 \cdot 1 - \left(z - \log z\right) \cdot \left(z - \log z\right)}\right)}\right)\right)\right) \]
      5. /-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 + \left(z - \log z\right)\right), \color{blue}{\left(1 \cdot 1 - \left(z - \log z\right) \cdot \left(z - \log z\right)\right)}\right)\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(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \left(z - \log z\right)\right), \left(\color{blue}{1 \cdot 1} - \left(z - \log z\right) \cdot \left(z - \log z\right)\right)\right)\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, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{\_.f64}\left(z, \log z\right)\right), \left(1 \cdot \color{blue}{1} - \left(z - \log z\right) \cdot \left(z - \log z\right)\right)\right)\right)\right)\right) \]
      8. log-lowering-log.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, \mathsf{\_.f64}\left(z, \mathsf{log.f64}\left(z\right)\right)\right), \left(1 \cdot 1 - \left(z - \log z\right) \cdot \left(z - \log z\right)\right)\right)\right)\right)\right) \]
      9. metadata-evalN/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, \mathsf{\_.f64}\left(z, \mathsf{log.f64}\left(z\right)\right)\right), \left(1 - \color{blue}{\left(z - \log z\right)} \cdot \left(z - \log z\right)\right)\right)\right)\right)\right) \]
      10. --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, \mathsf{\_.f64}\left(z, \mathsf{log.f64}\left(z\right)\right)\right), \mathsf{\_.f64}\left(1, \color{blue}{\left(\left(z - \log z\right) \cdot \left(z - \log z\right)\right)}\right)\right)\right)\right)\right) \]
      11. pow2N/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, \mathsf{\_.f64}\left(z, \mathsf{log.f64}\left(z\right)\right)\right), \mathsf{\_.f64}\left(1, \left({\left(z - \log z\right)}^{\color{blue}{2}}\right)\right)\right)\right)\right)\right) \]
      12. pow-lowering-pow.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, \mathsf{\_.f64}\left(z, \mathsf{log.f64}\left(z\right)\right)\right), \mathsf{\_.f64}\left(1, \mathsf{pow.f64}\left(\left(z - \log z\right), \color{blue}{2}\right)\right)\right)\right)\right)\right) \]
      13. --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, \mathsf{\_.f64}\left(z, \mathsf{log.f64}\left(z\right)\right)\right), \mathsf{\_.f64}\left(1, \mathsf{pow.f64}\left(\mathsf{\_.f64}\left(z, \log z\right), 2\right)\right)\right)\right)\right)\right) \]
      14. log-lowering-log.f6477.5%

        \[\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{\_.f64}\left(z, \mathsf{log.f64}\left(z\right)\right)\right), \mathsf{\_.f64}\left(1, \mathsf{pow.f64}\left(\mathsf{\_.f64}\left(z, \mathsf{log.f64}\left(z\right)\right), 2\right)\right)\right)\right)\right)\right) \]
    4. Applied egg-rr77.5%

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(y \cdot z\right) + \frac{1}{2} \cdot x} \]
    9. 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. *-commutativeN/A

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

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

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

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

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

Alternative 4: 85.3% accurate, 0.9× speedup?

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

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

\mathbf{elif}\;y \leq 2.6 \cdot 10^{+32}:\\
\;\;\;\;x \cdot 0.5 - y \cdot z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -8.09999999999999969e111

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

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

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

        \[\leadsto \mathsf{*.f64}\left(y, \left(1 + \color{blue}{\left(\log z + \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. +-lowering-+.f64N/A

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(\mathsf{+.f64}\left(\log z, 1\right), z\right)\right) \]
      5. log-lowering-log.f6491.7%

        \[\leadsto \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{log.f64}\left(z\right), 1\right), z\right)\right) \]
    7. Applied egg-rr91.7%

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

    if -8.09999999999999969e111 < y < 2.6000000000000002e32

    1. Initial program 99.9%

      \[x \cdot 0.5 + y \cdot \left(\left(1 - z\right) + \log z\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-+l-N/A

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{*.f64}\left(y, \left(\frac{1 \cdot 1 - \left(z - \log z\right) \cdot \left(z - \log z\right)}{\color{blue}{1 + \left(z - \log z\right)}}\right)\right)\right) \]
      3. 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{1 + \left(z - \log z\right)}{1 \cdot 1 - \left(z - \log z\right) \cdot \left(z - \log z\right)}}}\right)\right)\right) \]
      4. /-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(\frac{1 + \left(z - \log z\right)}{1 \cdot 1 - \left(z - \log z\right) \cdot \left(z - \log z\right)}\right)}\right)\right)\right) \]
      5. /-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 + \left(z - \log z\right)\right), \color{blue}{\left(1 \cdot 1 - \left(z - \log z\right) \cdot \left(z - \log z\right)\right)}\right)\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(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \left(z - \log z\right)\right), \left(\color{blue}{1 \cdot 1} - \left(z - \log z\right) \cdot \left(z - \log z\right)\right)\right)\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, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{\_.f64}\left(z, \log z\right)\right), \left(1 \cdot \color{blue}{1} - \left(z - \log z\right) \cdot \left(z - \log z\right)\right)\right)\right)\right)\right) \]
      8. log-lowering-log.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, \mathsf{\_.f64}\left(z, \mathsf{log.f64}\left(z\right)\right)\right), \left(1 \cdot 1 - \left(z - \log z\right) \cdot \left(z - \log z\right)\right)\right)\right)\right)\right) \]
      9. metadata-evalN/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, \mathsf{\_.f64}\left(z, \mathsf{log.f64}\left(z\right)\right)\right), \left(1 - \color{blue}{\left(z - \log z\right)} \cdot \left(z - \log z\right)\right)\right)\right)\right)\right) \]
      10. --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, \mathsf{\_.f64}\left(z, \mathsf{log.f64}\left(z\right)\right)\right), \mathsf{\_.f64}\left(1, \color{blue}{\left(\left(z - \log z\right) \cdot \left(z - \log z\right)\right)}\right)\right)\right)\right)\right) \]
      11. pow2N/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, \mathsf{\_.f64}\left(z, \mathsf{log.f64}\left(z\right)\right)\right), \mathsf{\_.f64}\left(1, \left({\left(z - \log z\right)}^{\color{blue}{2}}\right)\right)\right)\right)\right)\right) \]
      12. pow-lowering-pow.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, \mathsf{\_.f64}\left(z, \mathsf{log.f64}\left(z\right)\right)\right), \mathsf{\_.f64}\left(1, \mathsf{pow.f64}\left(\left(z - \log z\right), \color{blue}{2}\right)\right)\right)\right)\right)\right) \]
      13. --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, \mathsf{\_.f64}\left(z, \mathsf{log.f64}\left(z\right)\right)\right), \mathsf{\_.f64}\left(1, \mathsf{pow.f64}\left(\mathsf{\_.f64}\left(z, \log z\right), 2\right)\right)\right)\right)\right)\right) \]
      14. log-lowering-log.f6471.7%

        \[\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{\_.f64}\left(z, \mathsf{log.f64}\left(z\right)\right)\right), \mathsf{\_.f64}\left(1, \mathsf{pow.f64}\left(\mathsf{\_.f64}\left(z, \mathsf{log.f64}\left(z\right)\right), 2\right)\right)\right)\right)\right)\right) \]
    4. Applied egg-rr71.7%

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

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{*.f64}\left(y, \mathsf{/.f64}\left(1, \color{blue}{\left(\frac{-1}{z}\right)}\right)\right)\right) \]
    6. 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, \mathsf{/.f64}\left(-1, \color{blue}{z}\right)\right)\right)\right) \]
    7. Simplified87.1%

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

      \[\leadsto \color{blue}{-1 \cdot \left(y \cdot z\right) + \frac{1}{2} \cdot x} \]
    9. 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. *-commutativeN/A

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

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

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

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

    if 2.6000000000000002e32 < y

    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}{y \cdot \left(\left(1 + \log z\right) - z\right)} \]
    4. 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. sub-negN/A

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

        \[\leadsto \mathsf{*.f64}\left(y, \left(1 + \color{blue}{\left(\log z + \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. +-lowering-+.f64N/A

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

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

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

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

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

      \[\leadsto \color{blue}{y \cdot \left(1 + \left(\log z - z\right)\right)} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 5: 85.3% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
t_0 := y \cdot \left(1 + \left(\log z - z\right)\right)\\
\mathbf{if}\;y \leq -2.5 \cdot 10^{+112}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y \leq 5.4 \cdot 10^{+32}:\\
\;\;\;\;x \cdot 0.5 - y \cdot z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.5e112 or 5.40000000000000025e32 < y

    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}{y \cdot \left(\left(1 + \log z\right) - z\right)} \]
    4. 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. sub-negN/A

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

        \[\leadsto \mathsf{*.f64}\left(y, \left(1 + \color{blue}{\left(\log z + \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. +-lowering-+.f64N/A

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(y, \mathsf{+.f64}\left(1, \mathsf{\_.f64}\left(\mathsf{log.f64}\left(z\right), z\right)\right)\right) \]
    5. Simplified88.4%

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

    if -2.5e112 < y < 5.40000000000000025e32

    1. Initial program 99.9%

      \[x \cdot 0.5 + y \cdot \left(\left(1 - z\right) + \log z\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-+l-N/A

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{*.f64}\left(y, \left(\frac{1 \cdot 1 - \left(z - \log z\right) \cdot \left(z - \log z\right)}{\color{blue}{1 + \left(z - \log z\right)}}\right)\right)\right) \]
      3. 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{1 + \left(z - \log z\right)}{1 \cdot 1 - \left(z - \log z\right) \cdot \left(z - \log z\right)}}}\right)\right)\right) \]
      4. /-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(\frac{1 + \left(z - \log z\right)}{1 \cdot 1 - \left(z - \log z\right) \cdot \left(z - \log z\right)}\right)}\right)\right)\right) \]
      5. /-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 + \left(z - \log z\right)\right), \color{blue}{\left(1 \cdot 1 - \left(z - \log z\right) \cdot \left(z - \log z\right)\right)}\right)\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(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \left(z - \log z\right)\right), \left(\color{blue}{1 \cdot 1} - \left(z - \log z\right) \cdot \left(z - \log z\right)\right)\right)\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, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{\_.f64}\left(z, \log z\right)\right), \left(1 \cdot \color{blue}{1} - \left(z - \log z\right) \cdot \left(z - \log z\right)\right)\right)\right)\right)\right) \]
      8. log-lowering-log.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, \mathsf{\_.f64}\left(z, \mathsf{log.f64}\left(z\right)\right)\right), \left(1 \cdot 1 - \left(z - \log z\right) \cdot \left(z - \log z\right)\right)\right)\right)\right)\right) \]
      9. metadata-evalN/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, \mathsf{\_.f64}\left(z, \mathsf{log.f64}\left(z\right)\right)\right), \left(1 - \color{blue}{\left(z - \log z\right)} \cdot \left(z - \log z\right)\right)\right)\right)\right)\right) \]
      10. --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, \mathsf{\_.f64}\left(z, \mathsf{log.f64}\left(z\right)\right)\right), \mathsf{\_.f64}\left(1, \color{blue}{\left(\left(z - \log z\right) \cdot \left(z - \log z\right)\right)}\right)\right)\right)\right)\right) \]
      11. pow2N/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, \mathsf{\_.f64}\left(z, \mathsf{log.f64}\left(z\right)\right)\right), \mathsf{\_.f64}\left(1, \left({\left(z - \log z\right)}^{\color{blue}{2}}\right)\right)\right)\right)\right)\right) \]
      12. pow-lowering-pow.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, \mathsf{\_.f64}\left(z, \mathsf{log.f64}\left(z\right)\right)\right), \mathsf{\_.f64}\left(1, \mathsf{pow.f64}\left(\left(z - \log z\right), \color{blue}{2}\right)\right)\right)\right)\right)\right) \]
      13. --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, \mathsf{\_.f64}\left(z, \mathsf{log.f64}\left(z\right)\right)\right), \mathsf{\_.f64}\left(1, \mathsf{pow.f64}\left(\mathsf{\_.f64}\left(z, \log z\right), 2\right)\right)\right)\right)\right)\right) \]
      14. log-lowering-log.f6471.7%

        \[\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{\_.f64}\left(z, \mathsf{log.f64}\left(z\right)\right)\right), \mathsf{\_.f64}\left(1, \mathsf{pow.f64}\left(\mathsf{\_.f64}\left(z, \mathsf{log.f64}\left(z\right)\right), 2\right)\right)\right)\right)\right)\right) \]
    4. Applied egg-rr71.7%

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

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{*.f64}\left(y, \mathsf{/.f64}\left(1, \color{blue}{\left(\frac{-1}{z}\right)}\right)\right)\right) \]
    6. 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, \mathsf{/.f64}\left(-1, \color{blue}{z}\right)\right)\right)\right) \]
    7. Simplified87.1%

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

      \[\leadsto \color{blue}{-1 \cdot \left(y \cdot z\right) + \frac{1}{2} \cdot x} \]
    9. 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. *-commutativeN/A

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

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

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

      \[\leadsto \color{blue}{x \cdot 0.5 - y \cdot z} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 6: 98.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq 0.28:\\ \;\;\;\;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.28) (+ (* 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.28) {
		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.28d0) 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.28) {
		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.28:
		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.28)
		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.28)
		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.28], 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.28:\\
\;\;\;\;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.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 \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \color{blue}{\left(y \cdot \left(1 + \log z\right)\right)}\right) \]
    4. 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.2%

        \[\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) \]
    5. Simplified99.2%

      \[\leadsto x \cdot 0.5 + \color{blue}{y \cdot \left(1 + \log z\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. Step-by-step derivation
      1. associate-+l-N/A

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{*.f64}\left(y, \left(\frac{1 \cdot 1 - \left(z - \log z\right) \cdot \left(z - \log z\right)}{\color{blue}{1 + \left(z - \log z\right)}}\right)\right)\right) \]
      3. 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{1 + \left(z - \log z\right)}{1 \cdot 1 - \left(z - \log z\right) \cdot \left(z - \log z\right)}}}\right)\right)\right) \]
      4. /-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(\frac{1 + \left(z - \log z\right)}{1 \cdot 1 - \left(z - \log z\right) \cdot \left(z - \log z\right)}\right)}\right)\right)\right) \]
      5. /-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 + \left(z - \log z\right)\right), \color{blue}{\left(1 \cdot 1 - \left(z - \log z\right) \cdot \left(z - \log z\right)\right)}\right)\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(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \left(z - \log z\right)\right), \left(\color{blue}{1 \cdot 1} - \left(z - \log z\right) \cdot \left(z - \log z\right)\right)\right)\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, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{\_.f64}\left(z, \log z\right)\right), \left(1 \cdot \color{blue}{1} - \left(z - \log z\right) \cdot \left(z - \log z\right)\right)\right)\right)\right)\right) \]
      8. log-lowering-log.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, \mathsf{\_.f64}\left(z, \mathsf{log.f64}\left(z\right)\right)\right), \left(1 \cdot 1 - \left(z - \log z\right) \cdot \left(z - \log z\right)\right)\right)\right)\right)\right) \]
      9. metadata-evalN/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, \mathsf{\_.f64}\left(z, \mathsf{log.f64}\left(z\right)\right)\right), \left(1 - \color{blue}{\left(z - \log z\right)} \cdot \left(z - \log z\right)\right)\right)\right)\right)\right) \]
      10. --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, \mathsf{\_.f64}\left(z, \mathsf{log.f64}\left(z\right)\right)\right), \mathsf{\_.f64}\left(1, \color{blue}{\left(\left(z - \log z\right) \cdot \left(z - \log z\right)\right)}\right)\right)\right)\right)\right) \]
      11. pow2N/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, \mathsf{\_.f64}\left(z, \mathsf{log.f64}\left(z\right)\right)\right), \mathsf{\_.f64}\left(1, \left({\left(z - \log z\right)}^{\color{blue}{2}}\right)\right)\right)\right)\right)\right) \]
      12. pow-lowering-pow.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, \mathsf{\_.f64}\left(z, \mathsf{log.f64}\left(z\right)\right)\right), \mathsf{\_.f64}\left(1, \mathsf{pow.f64}\left(\left(z - \log z\right), \color{blue}{2}\right)\right)\right)\right)\right)\right) \]
      13. --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, \mathsf{\_.f64}\left(z, \mathsf{log.f64}\left(z\right)\right)\right), \mathsf{\_.f64}\left(1, \mathsf{pow.f64}\left(\mathsf{\_.f64}\left(z, \log z\right), 2\right)\right)\right)\right)\right)\right) \]
      14. log-lowering-log.f6462.8%

        \[\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{\_.f64}\left(z, \mathsf{log.f64}\left(z\right)\right)\right), \mathsf{\_.f64}\left(1, \mathsf{pow.f64}\left(\mathsf{\_.f64}\left(z, \mathsf{log.f64}\left(z\right)\right), 2\right)\right)\right)\right)\right)\right) \]
    4. Applied egg-rr62.8%

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(y \cdot z\right) + \frac{1}{2} \cdot x} \]
    9. 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. *-commutativeN/A

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 0.28:\\ \;\;\;\;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 7: 99.9% accurate, 1.0× speedup?

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

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

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

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

Alternative 8: 60.8% accurate, 11.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq 13500000000000:\\
\;\;\;\;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 < 1.35e13

    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 inf

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

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

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

    if 1.35e13 < 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 x around 0

      \[\leadsto \color{blue}{y \cdot \left(\left(1 + \log z\right) - z\right)} \]
    4. 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. sub-negN/A

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

        \[\leadsto \mathsf{*.f64}\left(y, \left(1 + \color{blue}{\left(\log z + \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. +-lowering-+.f64N/A

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(y, \mathsf{+.f64}\left(1, \mathsf{\_.f64}\left(\mathsf{log.f64}\left(z\right), z\right)\right)\right) \]
    5. Simplified69.0%

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

      \[\leadsto \mathsf{*.f64}\left(y, \mathsf{+.f64}\left(1, \color{blue}{\left(-1 \cdot z\right)}\right)\right) \]
    7. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{*.f64}\left(y, \mathsf{+.f64}\left(1, \left(\mathsf{neg}\left(z\right)\right)\right)\right) \]
      2. neg-sub0N/A

        \[\leadsto \mathsf{*.f64}\left(y, \mathsf{+.f64}\left(1, \left(0 - \color{blue}{z}\right)\right)\right) \]
      3. --lowering--.f6468.7%

        \[\leadsto \mathsf{*.f64}\left(y, \mathsf{+.f64}\left(1, \mathsf{\_.f64}\left(0, \color{blue}{z}\right)\right)\right) \]
    8. Simplified68.7%

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

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

Alternative 9: 60.8% accurate, 11.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq 3650000000000:\\
\;\;\;\;x \cdot 0.5\\

\mathbf{else}:\\
\;\;\;\;0 - y \cdot z\\


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

    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 inf

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

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

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

    if 3.65e12 < 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 \color{blue}{-1 \cdot \left(y \cdot z\right)} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

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

        \[\leadsto 0 - \color{blue}{y \cdot z} \]
      3. --lowering--.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(0, \color{blue}{\left(y \cdot z\right)}\right) \]
      4. *-lowering-*.f6468.7%

        \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(y, \color{blue}{z}\right)\right) \]
    5. Simplified68.7%

      \[\leadsto \color{blue}{0 - y \cdot z} \]
    6. Step-by-step derivation
      1. sub0-negN/A

        \[\leadsto \mathsf{neg}\left(y \cdot z\right) \]
      2. neg-lowering-neg.f64N/A

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

        \[\leadsto \mathsf{neg.f64}\left(\left(z \cdot y\right)\right) \]
      4. *-lowering-*.f6468.7%

        \[\leadsto \mathsf{neg.f64}\left(\mathsf{*.f64}\left(z, y\right)\right) \]
    7. Applied egg-rr68.7%

      \[\leadsto \color{blue}{-z \cdot y} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification61.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 3650000000000:\\ \;\;\;\;x \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;0 - y \cdot z\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 74.6% 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. Add Preprocessing
  3. Step-by-step derivation
    1. associate-+l-N/A

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

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{2}\right), \mathsf{*.f64}\left(y, \left(\frac{1 \cdot 1 - \left(z - \log z\right) \cdot \left(z - \log z\right)}{\color{blue}{1 + \left(z - \log z\right)}}\right)\right)\right) \]
    3. 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{1 + \left(z - \log z\right)}{1 \cdot 1 - \left(z - \log z\right) \cdot \left(z - \log z\right)}}}\right)\right)\right) \]
    4. /-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(\frac{1 + \left(z - \log z\right)}{1 \cdot 1 - \left(z - \log z\right) \cdot \left(z - \log z\right)}\right)}\right)\right)\right) \]
    5. /-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 + \left(z - \log z\right)\right), \color{blue}{\left(1 \cdot 1 - \left(z - \log z\right) \cdot \left(z - \log z\right)\right)}\right)\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(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \left(z - \log z\right)\right), \left(\color{blue}{1 \cdot 1} - \left(z - \log z\right) \cdot \left(z - \log z\right)\right)\right)\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, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{\_.f64}\left(z, \log z\right)\right), \left(1 \cdot \color{blue}{1} - \left(z - \log z\right) \cdot \left(z - \log z\right)\right)\right)\right)\right)\right) \]
    8. log-lowering-log.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, \mathsf{\_.f64}\left(z, \mathsf{log.f64}\left(z\right)\right)\right), \left(1 \cdot 1 - \left(z - \log z\right) \cdot \left(z - \log z\right)\right)\right)\right)\right)\right) \]
    9. metadata-evalN/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, \mathsf{\_.f64}\left(z, \mathsf{log.f64}\left(z\right)\right)\right), \left(1 - \color{blue}{\left(z - \log z\right)} \cdot \left(z - \log z\right)\right)\right)\right)\right)\right) \]
    10. --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, \mathsf{\_.f64}\left(z, \mathsf{log.f64}\left(z\right)\right)\right), \mathsf{\_.f64}\left(1, \color{blue}{\left(\left(z - \log z\right) \cdot \left(z - \log z\right)\right)}\right)\right)\right)\right)\right) \]
    11. pow2N/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, \mathsf{\_.f64}\left(z, \mathsf{log.f64}\left(z\right)\right)\right), \mathsf{\_.f64}\left(1, \left({\left(z - \log z\right)}^{\color{blue}{2}}\right)\right)\right)\right)\right)\right) \]
    12. pow-lowering-pow.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, \mathsf{\_.f64}\left(z, \mathsf{log.f64}\left(z\right)\right)\right), \mathsf{\_.f64}\left(1, \mathsf{pow.f64}\left(\left(z - \log z\right), \color{blue}{2}\right)\right)\right)\right)\right)\right) \]
    13. --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, \mathsf{\_.f64}\left(z, \mathsf{log.f64}\left(z\right)\right)\right), \mathsf{\_.f64}\left(1, \mathsf{pow.f64}\left(\mathsf{\_.f64}\left(z, \log z\right), 2\right)\right)\right)\right)\right)\right) \]
    14. log-lowering-log.f6480.7%

      \[\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{\_.f64}\left(z, \mathsf{log.f64}\left(z\right)\right)\right), \mathsf{\_.f64}\left(1, \mathsf{pow.f64}\left(\mathsf{\_.f64}\left(z, \mathsf{log.f64}\left(z\right)\right), 2\right)\right)\right)\right)\right)\right) \]
  4. Applied egg-rr80.7%

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

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

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

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

    \[\leadsto \color{blue}{-1 \cdot \left(y \cdot z\right) + \frac{1}{2} \cdot x} \]
  9. 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. *-commutativeN/A

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

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

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

    \[\leadsto \color{blue}{x \cdot 0.5 - y \cdot z} \]
  11. Add Preprocessing

Alternative 11: 40.3% 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. Add Preprocessing
  3. Taylor expanded in x around inf

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

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

    \[\leadsto \color{blue}{0.5 \cdot x} \]
  6. Final simplification43.5%

    \[\leadsto x \cdot 0.5 \]
  7. 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 2024191 
(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)))))