Numeric.SpecFunctions:stirlingError from math-functions-0.1.5.2

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

Specification

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

\\
\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z
\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.8% accurate, 1.0× speedup?

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

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

Alternative 1: 99.9% accurate, 0.5× speedup?

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

\\
x + \left(\mathsf{fma}\left(\log y, -0.5 - y, y\right) - z\right)
\end{array}
Derivation
  1. Initial program 99.8%

    \[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \]
  2. Step-by-step derivation
    1. associate--l+99.8%

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

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

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

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

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

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

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

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

      \[\leadsto x + \left(\mathsf{fma}\left(\log y, \color{blue}{\left(-0.5\right) + \left(-y\right)}, y\right) - z\right) \]
    10. unsub-neg99.9%

      \[\leadsto x + \left(\mathsf{fma}\left(\log y, \color{blue}{\left(-0.5\right) - y}, y\right) - z\right) \]
    11. metadata-eval99.9%

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

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

Alternative 2: 89.6% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.55 \cdot 10^{+117}:\\
\;\;\;\;x - z\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.54999999999999988e117

    1. Initial program 100.0%

      \[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. flip-+88.6%

        \[\leadsto \left(\left(x - \color{blue}{\frac{y \cdot y - 0.5 \cdot 0.5}{y - 0.5}} \cdot \log y\right) + y\right) - z \]
      2. div-inv88.6%

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

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

        \[\leadsto \left(\left(x - \left(\mathsf{fma}\left(y, y, -\color{blue}{0.25}\right) \cdot \frac{1}{y - 0.5}\right) \cdot \log y\right) + y\right) - z \]
      5. metadata-eval88.6%

        \[\leadsto \left(\left(x - \left(\mathsf{fma}\left(y, y, \color{blue}{-0.25}\right) \cdot \frac{1}{y - 0.5}\right) \cdot \log y\right) + y\right) - z \]
      6. sub-neg88.6%

        \[\leadsto \left(\left(x - \left(\mathsf{fma}\left(y, y, -0.25\right) \cdot \frac{1}{\color{blue}{y + \left(-0.5\right)}}\right) \cdot \log y\right) + y\right) - z \]
      7. metadata-eval88.6%

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

      \[\leadsto \left(\left(x - \color{blue}{\left(\mathsf{fma}\left(y, y, -0.25\right) \cdot \frac{1}{y + -0.5}\right)} \cdot \log y\right) + y\right) - z \]
    5. Step-by-step derivation
      1. *-commutative88.6%

        \[\leadsto \left(\left(x - \color{blue}{\left(\frac{1}{y + -0.5} \cdot \mathsf{fma}\left(y, y, -0.25\right)\right)} \cdot \log y\right) + y\right) - z \]
      2. associate-/r/88.6%

        \[\leadsto \left(\left(x - \color{blue}{\frac{1}{\frac{y + -0.5}{\mathsf{fma}\left(y, y, -0.25\right)}}} \cdot \log y\right) + y\right) - z \]
    6. Simplified88.6%

      \[\leadsto \left(\left(x - \color{blue}{\frac{1}{\frac{y + -0.5}{\mathsf{fma}\left(y, y, -0.25\right)}}} \cdot \log y\right) + y\right) - z \]
    7. Step-by-step derivation
      1. associate-+l-88.6%

        \[\leadsto \color{blue}{\left(x - \left(\frac{1}{\frac{y + -0.5}{\mathsf{fma}\left(y, y, -0.25\right)}} \cdot \log y - y\right)\right)} - z \]
      2. associate-*l/88.6%

        \[\leadsto \left(x - \left(\color{blue}{\frac{1 \cdot \log y}{\frac{y + -0.5}{\mathsf{fma}\left(y, y, -0.25\right)}}} - y\right)\right) - z \]
      3. *-un-lft-identity88.6%

        \[\leadsto \left(x - \left(\frac{\color{blue}{\log y}}{\frac{y + -0.5}{\mathsf{fma}\left(y, y, -0.25\right)}} - y\right)\right) - z \]
      4. clear-num88.6%

        \[\leadsto \left(x - \left(\frac{\log y}{\color{blue}{\frac{1}{\frac{\mathsf{fma}\left(y, y, -0.25\right)}{y + -0.5}}}} - y\right)\right) - z \]
      5. metadata-eval88.6%

        \[\leadsto \left(x - \left(\frac{\log y}{\frac{1}{\frac{\mathsf{fma}\left(y, y, \color{blue}{-0.25}\right)}{y + -0.5}}} - y\right)\right) - z \]
      6. metadata-eval88.6%

        \[\leadsto \left(x - \left(\frac{\log y}{\frac{1}{\frac{\mathsf{fma}\left(y, y, -\color{blue}{0.5 \cdot 0.5}\right)}{y + -0.5}}} - y\right)\right) - z \]
      7. fmm-def88.6%

        \[\leadsto \left(x - \left(\frac{\log y}{\frac{1}{\frac{\color{blue}{y \cdot y - 0.5 \cdot 0.5}}{y + -0.5}}} - y\right)\right) - z \]
      8. *-un-lft-identity88.6%

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

        \[\leadsto \left(x - \left(\frac{\log y}{\frac{1}{\frac{y \cdot y - 0.5 \cdot 0.5}{\color{blue}{\mathsf{fma}\left(1, y, -0.5\right)}}}} - y\right)\right) - z \]
      10. metadata-eval88.6%

        \[\leadsto \left(x - \left(\frac{\log y}{\frac{1}{\frac{y \cdot y - 0.5 \cdot 0.5}{\mathsf{fma}\left(1, y, \color{blue}{-0.5}\right)}}} - y\right)\right) - z \]
      11. fmm-def88.6%

        \[\leadsto \left(x - \left(\frac{\log y}{\frac{1}{\frac{y \cdot y - 0.5 \cdot 0.5}{\color{blue}{1 \cdot y - 0.5}}}} - y\right)\right) - z \]
      12. *-un-lft-identity88.6%

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

        \[\leadsto \left(x - \left(\frac{\log y}{\frac{1}{\color{blue}{y + 0.5}}} - y\right)\right) - z \]
    8. Applied egg-rr100.0%

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

      \[\leadsto \color{blue}{x} - z \]

    if -1.54999999999999988e117 < x < 1.29999999999999992e62

    1. Initial program 99.8%

      \[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \]
    2. Step-by-step derivation
      1. associate--l+99.8%

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

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

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

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

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

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

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

        \[\leadsto x + \left(\mathsf{fma}\left(\log y, -\color{blue}{\left(0.5 + y\right)}, y\right) - z\right) \]
      9. distribute-neg-in99.8%

        \[\leadsto x + \left(\mathsf{fma}\left(\log y, \color{blue}{\left(-0.5\right) + \left(-y\right)}, y\right) - z\right) \]
      10. unsub-neg99.8%

        \[\leadsto x + \left(\mathsf{fma}\left(\log y, \color{blue}{\left(-0.5\right) - y}, y\right) - z\right) \]
      11. metadata-eval99.8%

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

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

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

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

        \[\leadsto \left(y + \color{blue}{\left(-\log y\right)} \cdot \left(0.5 + y\right)\right) - z \]
      3. +-commutative96.6%

        \[\leadsto \left(y + \left(-\log y\right) \cdot \color{blue}{\left(y + 0.5\right)}\right) - z \]
      4. cancel-sign-sub-inv96.6%

        \[\leadsto \color{blue}{\left(y - \log y \cdot \left(y + 0.5\right)\right)} - z \]
    7. Simplified96.6%

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

    if 1.29999999999999992e62 < x

    1. Initial program 99.9%

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

      \[\leadsto \color{blue}{\left(x - 0.5 \cdot \log y\right)} - z \]
  3. Recombined 3 regimes into one program.
  4. Final simplification93.9%

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

Alternative 3: 73.5% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.3 \cdot 10^{-147}:\\
\;\;\;\;\log y \cdot -0.5 - z\\

\mathbf{elif}\;y \leq 1.5 \cdot 10^{+78}:\\
\;\;\;\;x - z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < 3.29999999999999987e-147

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\left(x - 0.5 \cdot \log y\right)} - z \]
    4. Taylor expanded in x around 0 76.5%

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

        \[\leadsto \color{blue}{-\left(z + 0.5 \cdot \log y\right)} \]
      2. distribute-neg-in76.5%

        \[\leadsto \color{blue}{\left(-z\right) + \left(-0.5 \cdot \log y\right)} \]
      3. sub-neg76.5%

        \[\leadsto \color{blue}{\left(-z\right) - 0.5 \cdot \log y} \]
      4. neg-sub076.5%

        \[\leadsto \color{blue}{\left(0 - z\right)} - 0.5 \cdot \log y \]
      5. associate--r+76.5%

        \[\leadsto \color{blue}{0 - \left(z + 0.5 \cdot \log y\right)} \]
      6. +-commutative76.5%

        \[\leadsto 0 - \color{blue}{\left(0.5 \cdot \log y + z\right)} \]
      7. associate--r+76.5%

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

        \[\leadsto \color{blue}{\left(-0.5 \cdot \log y\right)} - z \]
      9. distribute-lft-neg-in76.5%

        \[\leadsto \color{blue}{\left(-0.5\right) \cdot \log y} - z \]
      10. metadata-eval76.5%

        \[\leadsto \color{blue}{-0.5} \cdot \log y - z \]
      11. *-commutative76.5%

        \[\leadsto \color{blue}{\log y \cdot -0.5} - z \]
    6. Simplified76.5%

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

    if 3.29999999999999987e-147 < y < 1.49999999999999991e78

    1. Initial program 99.9%

      \[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. flip-+99.9%

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

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

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

        \[\leadsto \left(\left(x - \left(\mathsf{fma}\left(y, y, -\color{blue}{0.25}\right) \cdot \frac{1}{y - 0.5}\right) \cdot \log y\right) + y\right) - z \]
      5. metadata-eval99.9%

        \[\leadsto \left(\left(x - \left(\mathsf{fma}\left(y, y, \color{blue}{-0.25}\right) \cdot \frac{1}{y - 0.5}\right) \cdot \log y\right) + y\right) - z \]
      6. sub-neg99.9%

        \[\leadsto \left(\left(x - \left(\mathsf{fma}\left(y, y, -0.25\right) \cdot \frac{1}{\color{blue}{y + \left(-0.5\right)}}\right) \cdot \log y\right) + y\right) - z \]
      7. metadata-eval99.9%

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

      \[\leadsto \left(\left(x - \color{blue}{\left(\mathsf{fma}\left(y, y, -0.25\right) \cdot \frac{1}{y + -0.5}\right)} \cdot \log y\right) + y\right) - z \]
    5. Step-by-step derivation
      1. *-commutative99.9%

        \[\leadsto \left(\left(x - \color{blue}{\left(\frac{1}{y + -0.5} \cdot \mathsf{fma}\left(y, y, -0.25\right)\right)} \cdot \log y\right) + y\right) - z \]
      2. associate-/r/100.0%

        \[\leadsto \left(\left(x - \color{blue}{\frac{1}{\frac{y + -0.5}{\mathsf{fma}\left(y, y, -0.25\right)}}} \cdot \log y\right) + y\right) - z \]
    6. Simplified100.0%

      \[\leadsto \left(\left(x - \color{blue}{\frac{1}{\frac{y + -0.5}{\mathsf{fma}\left(y, y, -0.25\right)}}} \cdot \log y\right) + y\right) - z \]
    7. Step-by-step derivation
      1. associate-+l-100.0%

        \[\leadsto \color{blue}{\left(x - \left(\frac{1}{\frac{y + -0.5}{\mathsf{fma}\left(y, y, -0.25\right)}} \cdot \log y - y\right)\right)} - z \]
      2. associate-*l/100.0%

        \[\leadsto \left(x - \left(\color{blue}{\frac{1 \cdot \log y}{\frac{y + -0.5}{\mathsf{fma}\left(y, y, -0.25\right)}}} - y\right)\right) - z \]
      3. *-un-lft-identity100.0%

        \[\leadsto \left(x - \left(\frac{\color{blue}{\log y}}{\frac{y + -0.5}{\mathsf{fma}\left(y, y, -0.25\right)}} - y\right)\right) - z \]
      4. clear-num100.0%

        \[\leadsto \left(x - \left(\frac{\log y}{\color{blue}{\frac{1}{\frac{\mathsf{fma}\left(y, y, -0.25\right)}{y + -0.5}}}} - y\right)\right) - z \]
      5. metadata-eval100.0%

        \[\leadsto \left(x - \left(\frac{\log y}{\frac{1}{\frac{\mathsf{fma}\left(y, y, \color{blue}{-0.25}\right)}{y + -0.5}}} - y\right)\right) - z \]
      6. metadata-eval100.0%

        \[\leadsto \left(x - \left(\frac{\log y}{\frac{1}{\frac{\mathsf{fma}\left(y, y, -\color{blue}{0.5 \cdot 0.5}\right)}{y + -0.5}}} - y\right)\right) - z \]
      7. fmm-def100.0%

        \[\leadsto \left(x - \left(\frac{\log y}{\frac{1}{\frac{\color{blue}{y \cdot y - 0.5 \cdot 0.5}}{y + -0.5}}} - y\right)\right) - z \]
      8. *-un-lft-identity100.0%

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

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

        \[\leadsto \left(x - \left(\frac{\log y}{\frac{1}{\frac{y \cdot y - 0.5 \cdot 0.5}{\mathsf{fma}\left(1, y, \color{blue}{-0.5}\right)}}} - y\right)\right) - z \]
      11. fmm-def100.0%

        \[\leadsto \left(x - \left(\frac{\log y}{\frac{1}{\frac{y \cdot y - 0.5 \cdot 0.5}{\color{blue}{1 \cdot y - 0.5}}}} - y\right)\right) - z \]
      12. *-un-lft-identity100.0%

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

        \[\leadsto \left(x - \left(\frac{\log y}{\frac{1}{\color{blue}{y + 0.5}}} - y\right)\right) - z \]
    8. Applied egg-rr100.0%

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

      \[\leadsto \color{blue}{x} - z \]

    if 1.49999999999999991e78 < y

    1. Initial program 99.6%

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

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

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

        \[\leadsto \left(\left(-x \cdot \color{blue}{\left(\frac{\log y \cdot \left(0.5 + y\right)}{x} + \left(-1\right)\right)}\right) + y\right) - z \]
      3. associate-/l*75.1%

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

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

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

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

      \[\leadsto \color{blue}{y \cdot \left(1 - -1 \cdot \log \left(\frac{1}{y}\right)\right)} - z \]
    7. Step-by-step derivation
      1. mul-1-neg82.5%

        \[\leadsto y \cdot \left(1 - \color{blue}{\left(-\log \left(\frac{1}{y}\right)\right)}\right) - z \]
      2. log-rec82.5%

        \[\leadsto y \cdot \left(1 - \left(-\color{blue}{\left(-\log y\right)}\right)\right) - z \]
      3. remove-double-neg82.5%

        \[\leadsto y \cdot \left(1 - \color{blue}{\log y}\right) - z \]
    8. Simplified82.5%

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

Alternative 4: 67.3% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.2 \cdot 10^{-149}:\\
\;\;\;\;\log y \cdot -0.5 - z\\

\mathbf{elif}\;y \leq 2.85 \cdot 10^{+78}:\\
\;\;\;\;x - z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < 3.20000000000000002e-149

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\left(x - 0.5 \cdot \log y\right)} - z \]
    4. Taylor expanded in x around 0 76.5%

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

        \[\leadsto \color{blue}{-\left(z + 0.5 \cdot \log y\right)} \]
      2. distribute-neg-in76.5%

        \[\leadsto \color{blue}{\left(-z\right) + \left(-0.5 \cdot \log y\right)} \]
      3. sub-neg76.5%

        \[\leadsto \color{blue}{\left(-z\right) - 0.5 \cdot \log y} \]
      4. neg-sub076.5%

        \[\leadsto \color{blue}{\left(0 - z\right)} - 0.5 \cdot \log y \]
      5. associate--r+76.5%

        \[\leadsto \color{blue}{0 - \left(z + 0.5 \cdot \log y\right)} \]
      6. +-commutative76.5%

        \[\leadsto 0 - \color{blue}{\left(0.5 \cdot \log y + z\right)} \]
      7. associate--r+76.5%

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

        \[\leadsto \color{blue}{\left(-0.5 \cdot \log y\right)} - z \]
      9. distribute-lft-neg-in76.5%

        \[\leadsto \color{blue}{\left(-0.5\right) \cdot \log y} - z \]
      10. metadata-eval76.5%

        \[\leadsto \color{blue}{-0.5} \cdot \log y - z \]
      11. *-commutative76.5%

        \[\leadsto \color{blue}{\log y \cdot -0.5} - z \]
    6. Simplified76.5%

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

    if 3.20000000000000002e-149 < y < 2.84999999999999993e78

    1. Initial program 99.9%

      \[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. flip-+99.9%

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

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

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

        \[\leadsto \left(\left(x - \left(\mathsf{fma}\left(y, y, -\color{blue}{0.25}\right) \cdot \frac{1}{y - 0.5}\right) \cdot \log y\right) + y\right) - z \]
      5. metadata-eval99.9%

        \[\leadsto \left(\left(x - \left(\mathsf{fma}\left(y, y, \color{blue}{-0.25}\right) \cdot \frac{1}{y - 0.5}\right) \cdot \log y\right) + y\right) - z \]
      6. sub-neg99.9%

        \[\leadsto \left(\left(x - \left(\mathsf{fma}\left(y, y, -0.25\right) \cdot \frac{1}{\color{blue}{y + \left(-0.5\right)}}\right) \cdot \log y\right) + y\right) - z \]
      7. metadata-eval99.9%

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

      \[\leadsto \left(\left(x - \color{blue}{\left(\mathsf{fma}\left(y, y, -0.25\right) \cdot \frac{1}{y + -0.5}\right)} \cdot \log y\right) + y\right) - z \]
    5. Step-by-step derivation
      1. *-commutative99.9%

        \[\leadsto \left(\left(x - \color{blue}{\left(\frac{1}{y + -0.5} \cdot \mathsf{fma}\left(y, y, -0.25\right)\right)} \cdot \log y\right) + y\right) - z \]
      2. associate-/r/100.0%

        \[\leadsto \left(\left(x - \color{blue}{\frac{1}{\frac{y + -0.5}{\mathsf{fma}\left(y, y, -0.25\right)}}} \cdot \log y\right) + y\right) - z \]
    6. Simplified100.0%

      \[\leadsto \left(\left(x - \color{blue}{\frac{1}{\frac{y + -0.5}{\mathsf{fma}\left(y, y, -0.25\right)}}} \cdot \log y\right) + y\right) - z \]
    7. Step-by-step derivation
      1. associate-+l-100.0%

        \[\leadsto \color{blue}{\left(x - \left(\frac{1}{\frac{y + -0.5}{\mathsf{fma}\left(y, y, -0.25\right)}} \cdot \log y - y\right)\right)} - z \]
      2. associate-*l/100.0%

        \[\leadsto \left(x - \left(\color{blue}{\frac{1 \cdot \log y}{\frac{y + -0.5}{\mathsf{fma}\left(y, y, -0.25\right)}}} - y\right)\right) - z \]
      3. *-un-lft-identity100.0%

        \[\leadsto \left(x - \left(\frac{\color{blue}{\log y}}{\frac{y + -0.5}{\mathsf{fma}\left(y, y, -0.25\right)}} - y\right)\right) - z \]
      4. clear-num100.0%

        \[\leadsto \left(x - \left(\frac{\log y}{\color{blue}{\frac{1}{\frac{\mathsf{fma}\left(y, y, -0.25\right)}{y + -0.5}}}} - y\right)\right) - z \]
      5. metadata-eval100.0%

        \[\leadsto \left(x - \left(\frac{\log y}{\frac{1}{\frac{\mathsf{fma}\left(y, y, \color{blue}{-0.25}\right)}{y + -0.5}}} - y\right)\right) - z \]
      6. metadata-eval100.0%

        \[\leadsto \left(x - \left(\frac{\log y}{\frac{1}{\frac{\mathsf{fma}\left(y, y, -\color{blue}{0.5 \cdot 0.5}\right)}{y + -0.5}}} - y\right)\right) - z \]
      7. fmm-def100.0%

        \[\leadsto \left(x - \left(\frac{\log y}{\frac{1}{\frac{\color{blue}{y \cdot y - 0.5 \cdot 0.5}}{y + -0.5}}} - y\right)\right) - z \]
      8. *-un-lft-identity100.0%

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

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

        \[\leadsto \left(x - \left(\frac{\log y}{\frac{1}{\frac{y \cdot y - 0.5 \cdot 0.5}{\mathsf{fma}\left(1, y, \color{blue}{-0.5}\right)}}} - y\right)\right) - z \]
      11. fmm-def100.0%

        \[\leadsto \left(x - \left(\frac{\log y}{\frac{1}{\frac{y \cdot y - 0.5 \cdot 0.5}{\color{blue}{1 \cdot y - 0.5}}}} - y\right)\right) - z \]
      12. *-un-lft-identity100.0%

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

        \[\leadsto \left(x - \left(\frac{\log y}{\frac{1}{\color{blue}{y + 0.5}}} - y\right)\right) - z \]
    8. Applied egg-rr100.0%

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

      \[\leadsto \color{blue}{x} - z \]

    if 2.84999999999999993e78 < y

    1. Initial program 99.6%

      \[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \]
    2. Step-by-step derivation
      1. associate--l+99.6%

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

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

        \[\leadsto \color{blue}{x + \left(\left(-\left(y + 0.5\right) \cdot \log y\right) + \left(y - z\right)\right)} \]
      4. associate-+r-99.6%

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

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

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

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

        \[\leadsto x + \left(\mathsf{fma}\left(\log y, -\color{blue}{\left(0.5 + y\right)}, y\right) - z\right) \]
      9. distribute-neg-in99.7%

        \[\leadsto x + \left(\mathsf{fma}\left(\log y, \color{blue}{\left(-0.5\right) + \left(-y\right)}, y\right) - z\right) \]
      10. unsub-neg99.7%

        \[\leadsto x + \left(\mathsf{fma}\left(\log y, \color{blue}{\left(-0.5\right) - y}, y\right) - z\right) \]
      11. metadata-eval99.7%

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

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

      \[\leadsto \color{blue}{y \cdot \left(1 + \log \left(\frac{1}{y}\right)\right)} \]
    6. Step-by-step derivation
      1. log-rec69.9%

        \[\leadsto y \cdot \left(1 + \color{blue}{\left(-\log y\right)}\right) \]
      2. sub-neg69.9%

        \[\leadsto y \cdot \color{blue}{\left(1 - \log y\right)} \]
    7. Simplified69.9%

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

Alternative 5: 57.7% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -105 \lor \neg \left(z \leq -7.2 \cdot 10^{-122}\right):\\
\;\;\;\;x - z\\

\mathbf{else}:\\
\;\;\;\;\log y \cdot -0.5\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -105 or -7.19999999999999989e-122 < z

    1. Initial program 99.9%

      \[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. flip-+80.2%

        \[\leadsto \left(\left(x - \color{blue}{\frac{y \cdot y - 0.5 \cdot 0.5}{y - 0.5}} \cdot \log y\right) + y\right) - z \]
      2. div-inv80.2%

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

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

        \[\leadsto \left(\left(x - \left(\mathsf{fma}\left(y, y, -\color{blue}{0.25}\right) \cdot \frac{1}{y - 0.5}\right) \cdot \log y\right) + y\right) - z \]
      5. metadata-eval80.2%

        \[\leadsto \left(\left(x - \left(\mathsf{fma}\left(y, y, \color{blue}{-0.25}\right) \cdot \frac{1}{y - 0.5}\right) \cdot \log y\right) + y\right) - z \]
      6. sub-neg80.2%

        \[\leadsto \left(\left(x - \left(\mathsf{fma}\left(y, y, -0.25\right) \cdot \frac{1}{\color{blue}{y + \left(-0.5\right)}}\right) \cdot \log y\right) + y\right) - z \]
      7. metadata-eval80.2%

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

      \[\leadsto \left(\left(x - \color{blue}{\left(\mathsf{fma}\left(y, y, -0.25\right) \cdot \frac{1}{y + -0.5}\right)} \cdot \log y\right) + y\right) - z \]
    5. Step-by-step derivation
      1. *-commutative80.2%

        \[\leadsto \left(\left(x - \color{blue}{\left(\frac{1}{y + -0.5} \cdot \mathsf{fma}\left(y, y, -0.25\right)\right)} \cdot \log y\right) + y\right) - z \]
      2. associate-/r/80.2%

        \[\leadsto \left(\left(x - \color{blue}{\frac{1}{\frac{y + -0.5}{\mathsf{fma}\left(y, y, -0.25\right)}}} \cdot \log y\right) + y\right) - z \]
    6. Simplified80.2%

      \[\leadsto \left(\left(x - \color{blue}{\frac{1}{\frac{y + -0.5}{\mathsf{fma}\left(y, y, -0.25\right)}}} \cdot \log y\right) + y\right) - z \]
    7. Step-by-step derivation
      1. associate-+l-80.2%

        \[\leadsto \color{blue}{\left(x - \left(\frac{1}{\frac{y + -0.5}{\mathsf{fma}\left(y, y, -0.25\right)}} \cdot \log y - y\right)\right)} - z \]
      2. associate-*l/80.2%

        \[\leadsto \left(x - \left(\color{blue}{\frac{1 \cdot \log y}{\frac{y + -0.5}{\mathsf{fma}\left(y, y, -0.25\right)}}} - y\right)\right) - z \]
      3. *-un-lft-identity80.2%

        \[\leadsto \left(x - \left(\frac{\color{blue}{\log y}}{\frac{y + -0.5}{\mathsf{fma}\left(y, y, -0.25\right)}} - y\right)\right) - z \]
      4. clear-num80.2%

        \[\leadsto \left(x - \left(\frac{\log y}{\color{blue}{\frac{1}{\frac{\mathsf{fma}\left(y, y, -0.25\right)}{y + -0.5}}}} - y\right)\right) - z \]
      5. metadata-eval80.2%

        \[\leadsto \left(x - \left(\frac{\log y}{\frac{1}{\frac{\mathsf{fma}\left(y, y, \color{blue}{-0.25}\right)}{y + -0.5}}} - y\right)\right) - z \]
      6. metadata-eval80.2%

        \[\leadsto \left(x - \left(\frac{\log y}{\frac{1}{\frac{\mathsf{fma}\left(y, y, -\color{blue}{0.5 \cdot 0.5}\right)}{y + -0.5}}} - y\right)\right) - z \]
      7. fmm-def80.2%

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

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

        \[\leadsto \left(x - \left(\frac{\log y}{\frac{1}{\frac{y \cdot y - 0.5 \cdot 0.5}{\color{blue}{\mathsf{fma}\left(1, y, -0.5\right)}}}} - y\right)\right) - z \]
      10. metadata-eval80.2%

        \[\leadsto \left(x - \left(\frac{\log y}{\frac{1}{\frac{y \cdot y - 0.5 \cdot 0.5}{\mathsf{fma}\left(1, y, \color{blue}{-0.5}\right)}}} - y\right)\right) - z \]
      11. fmm-def80.2%

        \[\leadsto \left(x - \left(\frac{\log y}{\frac{1}{\frac{y \cdot y - 0.5 \cdot 0.5}{\color{blue}{1 \cdot y - 0.5}}}} - y\right)\right) - z \]
      12. *-un-lft-identity80.2%

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

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

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

      \[\leadsto \color{blue}{x} - z \]

    if -105 < z < -7.19999999999999989e-122

    1. Initial program 99.7%

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

      \[\leadsto \color{blue}{\left(x - 0.5 \cdot \log y\right)} - z \]
    4. Taylor expanded in z around 0 56.3%

      \[\leadsto \color{blue}{x - 0.5 \cdot \log y} \]
    5. Taylor expanded in x around 0 46.4%

      \[\leadsto \color{blue}{-0.5 \cdot \log y} \]
    6. Step-by-step derivation
      1. *-commutative46.4%

        \[\leadsto \color{blue}{\log y \cdot -0.5} \]
    7. Simplified46.4%

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

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

Alternative 6: 89.1% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 100.0%

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

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

    if 1.84999999999999992e78 < y

    1. Initial program 99.6%

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

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

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

        \[\leadsto \left(\left(-x \cdot \color{blue}{\left(\frac{\log y \cdot \left(0.5 + y\right)}{x} + \left(-1\right)\right)}\right) + y\right) - z \]
      3. associate-/l*75.1%

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

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

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

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

      \[\leadsto \color{blue}{y \cdot \left(1 - -1 \cdot \log \left(\frac{1}{y}\right)\right)} - z \]
    7. Step-by-step derivation
      1. mul-1-neg82.5%

        \[\leadsto y \cdot \left(1 - \color{blue}{\left(-\log \left(\frac{1}{y}\right)\right)}\right) - z \]
      2. log-rec82.5%

        \[\leadsto y \cdot \left(1 - \left(-\color{blue}{\left(-\log y\right)}\right)\right) - z \]
      3. remove-double-neg82.5%

        \[\leadsto y \cdot \left(1 - \color{blue}{\log y}\right) - z \]
    8. Simplified82.5%

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

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

Alternative 7: 99.8% accurate, 1.0× speedup?

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

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

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

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

Alternative 8: 70.9% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.68 \cdot 10^{+78}:\\
\;\;\;\;x - z\\

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


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

    1. Initial program 100.0%

      \[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. flip-+100.0%

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

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

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

        \[\leadsto \left(\left(x - \left(\mathsf{fma}\left(y, y, -\color{blue}{0.25}\right) \cdot \frac{1}{y - 0.5}\right) \cdot \log y\right) + y\right) - z \]
      5. metadata-eval100.0%

        \[\leadsto \left(\left(x - \left(\mathsf{fma}\left(y, y, \color{blue}{-0.25}\right) \cdot \frac{1}{y - 0.5}\right) \cdot \log y\right) + y\right) - z \]
      6. sub-neg100.0%

        \[\leadsto \left(\left(x - \left(\mathsf{fma}\left(y, y, -0.25\right) \cdot \frac{1}{\color{blue}{y + \left(-0.5\right)}}\right) \cdot \log y\right) + y\right) - z \]
      7. metadata-eval100.0%

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

      \[\leadsto \left(\left(x - \color{blue}{\left(\mathsf{fma}\left(y, y, -0.25\right) \cdot \frac{1}{y + -0.5}\right)} \cdot \log y\right) + y\right) - z \]
    5. Step-by-step derivation
      1. *-commutative100.0%

        \[\leadsto \left(\left(x - \color{blue}{\left(\frac{1}{y + -0.5} \cdot \mathsf{fma}\left(y, y, -0.25\right)\right)} \cdot \log y\right) + y\right) - z \]
      2. associate-/r/100.0%

        \[\leadsto \left(\left(x - \color{blue}{\frac{1}{\frac{y + -0.5}{\mathsf{fma}\left(y, y, -0.25\right)}}} \cdot \log y\right) + y\right) - z \]
    6. Simplified100.0%

      \[\leadsto \left(\left(x - \color{blue}{\frac{1}{\frac{y + -0.5}{\mathsf{fma}\left(y, y, -0.25\right)}}} \cdot \log y\right) + y\right) - z \]
    7. Step-by-step derivation
      1. associate-+l-100.0%

        \[\leadsto \color{blue}{\left(x - \left(\frac{1}{\frac{y + -0.5}{\mathsf{fma}\left(y, y, -0.25\right)}} \cdot \log y - y\right)\right)} - z \]
      2. associate-*l/100.0%

        \[\leadsto \left(x - \left(\color{blue}{\frac{1 \cdot \log y}{\frac{y + -0.5}{\mathsf{fma}\left(y, y, -0.25\right)}}} - y\right)\right) - z \]
      3. *-un-lft-identity100.0%

        \[\leadsto \left(x - \left(\frac{\color{blue}{\log y}}{\frac{y + -0.5}{\mathsf{fma}\left(y, y, -0.25\right)}} - y\right)\right) - z \]
      4. clear-num100.0%

        \[\leadsto \left(x - \left(\frac{\log y}{\color{blue}{\frac{1}{\frac{\mathsf{fma}\left(y, y, -0.25\right)}{y + -0.5}}}} - y\right)\right) - z \]
      5. metadata-eval100.0%

        \[\leadsto \left(x - \left(\frac{\log y}{\frac{1}{\frac{\mathsf{fma}\left(y, y, \color{blue}{-0.25}\right)}{y + -0.5}}} - y\right)\right) - z \]
      6. metadata-eval100.0%

        \[\leadsto \left(x - \left(\frac{\log y}{\frac{1}{\frac{\mathsf{fma}\left(y, y, -\color{blue}{0.5 \cdot 0.5}\right)}{y + -0.5}}} - y\right)\right) - z \]
      7. fmm-def100.0%

        \[\leadsto \left(x - \left(\frac{\log y}{\frac{1}{\frac{\color{blue}{y \cdot y - 0.5 \cdot 0.5}}{y + -0.5}}} - y\right)\right) - z \]
      8. *-un-lft-identity100.0%

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

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

        \[\leadsto \left(x - \left(\frac{\log y}{\frac{1}{\frac{y \cdot y - 0.5 \cdot 0.5}{\mathsf{fma}\left(1, y, \color{blue}{-0.5}\right)}}} - y\right)\right) - z \]
      11. fmm-def100.0%

        \[\leadsto \left(x - \left(\frac{\log y}{\frac{1}{\frac{y \cdot y - 0.5 \cdot 0.5}{\color{blue}{1 \cdot y - 0.5}}}} - y\right)\right) - z \]
      12. *-un-lft-identity100.0%

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

        \[\leadsto \left(x - \left(\frac{\log y}{\frac{1}{\color{blue}{y + 0.5}}} - y\right)\right) - z \]
    8. Applied egg-rr100.0%

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

      \[\leadsto \color{blue}{x} - z \]

    if 1.6799999999999999e78 < y

    1. Initial program 99.6%

      \[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \]
    2. Step-by-step derivation
      1. associate--l+99.6%

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

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

        \[\leadsto \color{blue}{x + \left(\left(-\left(y + 0.5\right) \cdot \log y\right) + \left(y - z\right)\right)} \]
      4. associate-+r-99.6%

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

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

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

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

        \[\leadsto x + \left(\mathsf{fma}\left(\log y, -\color{blue}{\left(0.5 + y\right)}, y\right) - z\right) \]
      9. distribute-neg-in99.7%

        \[\leadsto x + \left(\mathsf{fma}\left(\log y, \color{blue}{\left(-0.5\right) + \left(-y\right)}, y\right) - z\right) \]
      10. unsub-neg99.7%

        \[\leadsto x + \left(\mathsf{fma}\left(\log y, \color{blue}{\left(-0.5\right) - y}, y\right) - z\right) \]
      11. metadata-eval99.7%

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

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

      \[\leadsto \color{blue}{y \cdot \left(1 + \log \left(\frac{1}{y}\right)\right)} \]
    6. Step-by-step derivation
      1. log-rec69.9%

        \[\leadsto y \cdot \left(1 + \color{blue}{\left(-\log y\right)}\right) \]
      2. sub-neg69.9%

        \[\leadsto y \cdot \color{blue}{\left(1 - \log y\right)} \]
    7. Simplified69.9%

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

Alternative 9: 49.1% accurate, 9.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.85 \cdot 10^{+81}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 1.35 \cdot 10^{+59}:\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= x -1.85e+81) x (if (<= x 1.35e+59) (- z) x)))
double code(double x, double y, double z) {
	double tmp;
	if (x <= -1.85e+81) {
		tmp = x;
	} else if (x <= 1.35e+59) {
		tmp = -z;
	} else {
		tmp = x;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (x <= (-1.85d+81)) then
        tmp = x
    else if (x <= 1.35d+59) then
        tmp = -z
    else
        tmp = x
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (x <= -1.85e+81) {
		tmp = x;
	} else if (x <= 1.35e+59) {
		tmp = -z;
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if x <= -1.85e+81:
		tmp = x
	elif x <= 1.35e+59:
		tmp = -z
	else:
		tmp = x
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (x <= -1.85e+81)
		tmp = x;
	elseif (x <= 1.35e+59)
		tmp = Float64(-z);
	else
		tmp = x;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (x <= -1.85e+81)
		tmp = x;
	elseif (x <= 1.35e+59)
		tmp = -z;
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[x, -1.85e+81], x, If[LessEqual[x, 1.35e+59], (-z), x]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.85 \cdot 10^{+81}:\\
\;\;\;\;x\\

\mathbf{elif}\;x \leq 1.35 \cdot 10^{+59}:\\
\;\;\;\;-z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.85e81 or 1.3500000000000001e59 < x

    1. Initial program 99.9%

      \[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \]
    2. Step-by-step derivation
      1. associate--l+99.9%

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

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

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

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

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

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

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

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

        \[\leadsto x + \left(\mathsf{fma}\left(\log y, \color{blue}{\left(-0.5\right) + \left(-y\right)}, y\right) - z\right) \]
      10. unsub-neg99.9%

        \[\leadsto x + \left(\mathsf{fma}\left(\log y, \color{blue}{\left(-0.5\right) - y}, y\right) - z\right) \]
      11. metadata-eval99.9%

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

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

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

    if -1.85e81 < x < 1.3500000000000001e59

    1. Initial program 99.8%

      \[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \]
    2. Step-by-step derivation
      1. associate--l+99.8%

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

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

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

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

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

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

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

        \[\leadsto x + \left(\mathsf{fma}\left(\log y, -\color{blue}{\left(0.5 + y\right)}, y\right) - z\right) \]
      9. distribute-neg-in99.8%

        \[\leadsto x + \left(\mathsf{fma}\left(\log y, \color{blue}{\left(-0.5\right) + \left(-y\right)}, y\right) - z\right) \]
      10. unsub-neg99.8%

        \[\leadsto x + \left(\mathsf{fma}\left(\log y, \color{blue}{\left(-0.5\right) - y}, y\right) - z\right) \]
      11. metadata-eval99.8%

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

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

      \[\leadsto \color{blue}{-1 \cdot z} \]
    6. Step-by-step derivation
      1. neg-mul-139.8%

        \[\leadsto \color{blue}{-z} \]
    7. Simplified39.8%

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

Alternative 10: 58.9% accurate, 37.0× speedup?

\[\begin{array}{l} \\ x - z \end{array} \]
(FPCore (x y z) :precision binary64 (- x z))
double code(double x, double y, double z) {
	return x - 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 - z
end function
public static double code(double x, double y, double z) {
	return x - z;
}
def code(x, y, z):
	return x - z
function code(x, y, z)
	return Float64(x - z)
end
function tmp = code(x, y, z)
	tmp = x - z;
end
code[x_, y_, z_] := N[(x - z), $MachinePrecision]
\begin{array}{l}

\\
x - z
\end{array}
Derivation
  1. Initial program 99.8%

    \[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. flip-+79.7%

      \[\leadsto \left(\left(x - \color{blue}{\frac{y \cdot y - 0.5 \cdot 0.5}{y - 0.5}} \cdot \log y\right) + y\right) - z \]
    2. div-inv79.7%

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

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

      \[\leadsto \left(\left(x - \left(\mathsf{fma}\left(y, y, -\color{blue}{0.25}\right) \cdot \frac{1}{y - 0.5}\right) \cdot \log y\right) + y\right) - z \]
    5. metadata-eval79.7%

      \[\leadsto \left(\left(x - \left(\mathsf{fma}\left(y, y, \color{blue}{-0.25}\right) \cdot \frac{1}{y - 0.5}\right) \cdot \log y\right) + y\right) - z \]
    6. sub-neg79.7%

      \[\leadsto \left(\left(x - \left(\mathsf{fma}\left(y, y, -0.25\right) \cdot \frac{1}{\color{blue}{y + \left(-0.5\right)}}\right) \cdot \log y\right) + y\right) - z \]
    7. metadata-eval79.7%

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

    \[\leadsto \left(\left(x - \color{blue}{\left(\mathsf{fma}\left(y, y, -0.25\right) \cdot \frac{1}{y + -0.5}\right)} \cdot \log y\right) + y\right) - z \]
  5. Step-by-step derivation
    1. *-commutative79.7%

      \[\leadsto \left(\left(x - \color{blue}{\left(\frac{1}{y + -0.5} \cdot \mathsf{fma}\left(y, y, -0.25\right)\right)} \cdot \log y\right) + y\right) - z \]
    2. associate-/r/79.7%

      \[\leadsto \left(\left(x - \color{blue}{\frac{1}{\frac{y + -0.5}{\mathsf{fma}\left(y, y, -0.25\right)}}} \cdot \log y\right) + y\right) - z \]
  6. Simplified79.7%

    \[\leadsto \left(\left(x - \color{blue}{\frac{1}{\frac{y + -0.5}{\mathsf{fma}\left(y, y, -0.25\right)}}} \cdot \log y\right) + y\right) - z \]
  7. Step-by-step derivation
    1. associate-+l-79.7%

      \[\leadsto \color{blue}{\left(x - \left(\frac{1}{\frac{y + -0.5}{\mathsf{fma}\left(y, y, -0.25\right)}} \cdot \log y - y\right)\right)} - z \]
    2. associate-*l/79.8%

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

      \[\leadsto \left(x - \left(\frac{\color{blue}{\log y}}{\frac{y + -0.5}{\mathsf{fma}\left(y, y, -0.25\right)}} - y\right)\right) - z \]
    4. clear-num79.7%

      \[\leadsto \left(x - \left(\frac{\log y}{\color{blue}{\frac{1}{\frac{\mathsf{fma}\left(y, y, -0.25\right)}{y + -0.5}}}} - y\right)\right) - z \]
    5. metadata-eval79.7%

      \[\leadsto \left(x - \left(\frac{\log y}{\frac{1}{\frac{\mathsf{fma}\left(y, y, \color{blue}{-0.25}\right)}{y + -0.5}}} - y\right)\right) - z \]
    6. metadata-eval79.7%

      \[\leadsto \left(x - \left(\frac{\log y}{\frac{1}{\frac{\mathsf{fma}\left(y, y, -\color{blue}{0.5 \cdot 0.5}\right)}{y + -0.5}}} - y\right)\right) - z \]
    7. fmm-def79.7%

      \[\leadsto \left(x - \left(\frac{\log y}{\frac{1}{\frac{\color{blue}{y \cdot y - 0.5 \cdot 0.5}}{y + -0.5}}} - y\right)\right) - z \]
    8. *-un-lft-identity79.7%

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

      \[\leadsto \left(x - \left(\frac{\log y}{\frac{1}{\frac{y \cdot y - 0.5 \cdot 0.5}{\color{blue}{\mathsf{fma}\left(1, y, -0.5\right)}}}} - y\right)\right) - z \]
    10. metadata-eval79.7%

      \[\leadsto \left(x - \left(\frac{\log y}{\frac{1}{\frac{y \cdot y - 0.5 \cdot 0.5}{\mathsf{fma}\left(1, y, \color{blue}{-0.5}\right)}}} - y\right)\right) - z \]
    11. fmm-def79.7%

      \[\leadsto \left(x - \left(\frac{\log y}{\frac{1}{\frac{y \cdot y - 0.5 \cdot 0.5}{\color{blue}{1 \cdot y - 0.5}}}} - y\right)\right) - z \]
    12. *-un-lft-identity79.7%

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

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

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

    \[\leadsto \color{blue}{x} - z \]
  10. Add Preprocessing

Alternative 11: 30.3% accurate, 111.0× speedup?

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

\\
x
\end{array}
Derivation
  1. Initial program 99.8%

    \[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \]
  2. Step-by-step derivation
    1. associate--l+99.8%

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

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

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

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

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

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

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

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

      \[\leadsto x + \left(\mathsf{fma}\left(\log y, \color{blue}{\left(-0.5\right) + \left(-y\right)}, y\right) - z\right) \]
    10. unsub-neg99.9%

      \[\leadsto x + \left(\mathsf{fma}\left(\log y, \color{blue}{\left(-0.5\right) - y}, y\right) - z\right) \]
    11. metadata-eval99.9%

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

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

    \[\leadsto \color{blue}{x} \]
  6. Add Preprocessing

Developer Target 1: 99.8% accurate, 1.0× speedup?

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

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

Reproduce

?
herbie shell --seed 2024185 
(FPCore (x y z)
  :name "Numeric.SpecFunctions:stirlingError from math-functions-0.1.5.2"
  :precision binary64

  :alt
  (! :herbie-platform default (- (- (+ y x) z) (* (+ y 1/2) (log y))))

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