Numeric.SpecFunctions:stirlingError from math-functions-0.1.5.2

Percentage Accurate: 99.8% → 99.9%
Time: 16.0s
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.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. Add Preprocessing

Alternative 2: 66.0% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \log y \cdot -0.5 - z\\ t_1 := y \cdot \left(1 - \log y\right)\\ t_2 := \left(x + y\right) - z\\ \mathbf{if}\;y \leq 1.42 \cdot 10^{-164}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq 4.8 \cdot 10^{-42}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;y \leq 2.8 \cdot 10^{-18}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq 1.85 \cdot 10^{+20}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;y \leq 1.45 \cdot 10^{+74}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 9.2 \cdot 10^{+110}:\\ \;\;\;\;x - z\\ \mathbf{elif}\;y \leq 1.25 \cdot 10^{+183}:\\ \;\;\;\;y - y \cdot \log y\\ \mathbf{elif}\;y \leq 1.3 \cdot 10^{+183}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (- (* (log y) -0.5) z))
        (t_1 (* y (- 1.0 (log y))))
        (t_2 (- (+ x y) z)))
   (if (<= y 1.42e-164)
     t_0
     (if (<= y 4.8e-42)
       t_2
       (if (<= y 2.8e-18)
         t_0
         (if (<= y 1.85e+20)
           t_2
           (if (<= y 1.45e+74)
             t_1
             (if (<= y 9.2e+110)
               (- x z)
               (if (<= y 1.25e+183)
                 (- y (* y (log y)))
                 (if (<= y 1.3e+183) x t_1))))))))))
double code(double x, double y, double z) {
	double t_0 = (log(y) * -0.5) - z;
	double t_1 = y * (1.0 - log(y));
	double t_2 = (x + y) - z;
	double tmp;
	if (y <= 1.42e-164) {
		tmp = t_0;
	} else if (y <= 4.8e-42) {
		tmp = t_2;
	} else if (y <= 2.8e-18) {
		tmp = t_0;
	} else if (y <= 1.85e+20) {
		tmp = t_2;
	} else if (y <= 1.45e+74) {
		tmp = t_1;
	} else if (y <= 9.2e+110) {
		tmp = x - z;
	} else if (y <= 1.25e+183) {
		tmp = y - (y * log(y));
	} else if (y <= 1.3e+183) {
		tmp = x;
	} 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) :: t_2
    real(8) :: tmp
    t_0 = (log(y) * (-0.5d0)) - z
    t_1 = y * (1.0d0 - log(y))
    t_2 = (x + y) - z
    if (y <= 1.42d-164) then
        tmp = t_0
    else if (y <= 4.8d-42) then
        tmp = t_2
    else if (y <= 2.8d-18) then
        tmp = t_0
    else if (y <= 1.85d+20) then
        tmp = t_2
    else if (y <= 1.45d+74) then
        tmp = t_1
    else if (y <= 9.2d+110) then
        tmp = x - z
    else if (y <= 1.25d+183) then
        tmp = y - (y * log(y))
    else if (y <= 1.3d+183) then
        tmp = x
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = (Math.log(y) * -0.5) - z;
	double t_1 = y * (1.0 - Math.log(y));
	double t_2 = (x + y) - z;
	double tmp;
	if (y <= 1.42e-164) {
		tmp = t_0;
	} else if (y <= 4.8e-42) {
		tmp = t_2;
	} else if (y <= 2.8e-18) {
		tmp = t_0;
	} else if (y <= 1.85e+20) {
		tmp = t_2;
	} else if (y <= 1.45e+74) {
		tmp = t_1;
	} else if (y <= 9.2e+110) {
		tmp = x - z;
	} else if (y <= 1.25e+183) {
		tmp = y - (y * Math.log(y));
	} else if (y <= 1.3e+183) {
		tmp = x;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = (math.log(y) * -0.5) - z
	t_1 = y * (1.0 - math.log(y))
	t_2 = (x + y) - z
	tmp = 0
	if y <= 1.42e-164:
		tmp = t_0
	elif y <= 4.8e-42:
		tmp = t_2
	elif y <= 2.8e-18:
		tmp = t_0
	elif y <= 1.85e+20:
		tmp = t_2
	elif y <= 1.45e+74:
		tmp = t_1
	elif y <= 9.2e+110:
		tmp = x - z
	elif y <= 1.25e+183:
		tmp = y - (y * math.log(y))
	elif y <= 1.3e+183:
		tmp = x
	else:
		tmp = t_1
	return tmp
function code(x, y, z)
	t_0 = Float64(Float64(log(y) * -0.5) - z)
	t_1 = Float64(y * Float64(1.0 - log(y)))
	t_2 = Float64(Float64(x + y) - z)
	tmp = 0.0
	if (y <= 1.42e-164)
		tmp = t_0;
	elseif (y <= 4.8e-42)
		tmp = t_2;
	elseif (y <= 2.8e-18)
		tmp = t_0;
	elseif (y <= 1.85e+20)
		tmp = t_2;
	elseif (y <= 1.45e+74)
		tmp = t_1;
	elseif (y <= 9.2e+110)
		tmp = Float64(x - z);
	elseif (y <= 1.25e+183)
		tmp = Float64(y - Float64(y * log(y)));
	elseif (y <= 1.3e+183)
		tmp = x;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = (log(y) * -0.5) - z;
	t_1 = y * (1.0 - log(y));
	t_2 = (x + y) - z;
	tmp = 0.0;
	if (y <= 1.42e-164)
		tmp = t_0;
	elseif (y <= 4.8e-42)
		tmp = t_2;
	elseif (y <= 2.8e-18)
		tmp = t_0;
	elseif (y <= 1.85e+20)
		tmp = t_2;
	elseif (y <= 1.45e+74)
		tmp = t_1;
	elseif (y <= 9.2e+110)
		tmp = x - z;
	elseif (y <= 1.25e+183)
		tmp = y - (y * log(y));
	elseif (y <= 1.3e+183)
		tmp = x;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[Log[y], $MachinePrecision] * -0.5), $MachinePrecision] - z), $MachinePrecision]}, Block[{t$95$1 = N[(y * N[(1.0 - N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x + y), $MachinePrecision] - z), $MachinePrecision]}, If[LessEqual[y, 1.42e-164], t$95$0, If[LessEqual[y, 4.8e-42], t$95$2, If[LessEqual[y, 2.8e-18], t$95$0, If[LessEqual[y, 1.85e+20], t$95$2, If[LessEqual[y, 1.45e+74], t$95$1, If[LessEqual[y, 9.2e+110], N[(x - z), $MachinePrecision], If[LessEqual[y, 1.25e+183], N[(y - N[(y * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.3e+183], x, t$95$1]]]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq 4.8 \cdot 10^{-42}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;y \leq 2.8 \cdot 10^{-18}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y \leq 1.85 \cdot 10^{+20}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;y \leq 1.45 \cdot 10^{+74}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;y \leq 1.25 \cdot 10^{+183}:\\
\;\;\;\;y - y \cdot \log y\\

\mathbf{elif}\;y \leq 1.3 \cdot 10^{+183}:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 6 regimes
  2. if y < 1.4200000000000001e-164 or 4.80000000000000005e-42 < y < 2.80000000000000012e-18

    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. Step-by-step derivation
      1. *-commutative100.0%

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

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

      \[\leadsto \color{blue}{-0.5 \cdot \log y} - z \]
    7. Step-by-step derivation
      1. *-commutative78.9%

        \[\leadsto \color{blue}{\log y \cdot -0.5} - z \]
    8. Simplified78.9%

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

    if 1.4200000000000001e-164 < y < 4.80000000000000005e-42 or 2.80000000000000012e-18 < y < 1.85e20

    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 x around -inf 99.9%

      \[\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-neg99.9%

        \[\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-neg99.9%

        \[\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*99.9%

        \[\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. +-commutative99.9%

        \[\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-eval99.9%

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

      \[\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 x around inf 83.1%

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

        \[\leadsto \left(\left(-\color{blue}{\left(-x\right)}\right) + y\right) - z \]
    8. Simplified83.1%

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

    if 1.85e20 < y < 1.4500000000000001e74 or 1.3e183 < y

    1. Initial program 99.4%

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

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

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

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

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

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

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

      \[\leadsto z \cdot \left(\frac{x}{z} + \color{blue}{y \cdot \left(\frac{1}{z} - -1 \cdot \frac{\log \left(\frac{1}{y}\right)}{z}\right)}\right) \]
    8. Step-by-step derivation
      1. cancel-sign-sub-inv57.3%

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

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

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

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

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

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

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

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

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

        \[\leadsto z \cdot \left(\frac{x}{z} + \color{blue}{\frac{y}{\frac{z}{1 - \log y}}}\right) \]
    11. Applied egg-rr57.3%

      \[\leadsto z \cdot \left(\frac{x}{z} + \color{blue}{\frac{y}{\frac{z}{1 - \log y}}}\right) \]
    12. Step-by-step derivation
      1. associate-/r/57.4%

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

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

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

    if 1.4500000000000001e74 < y < 9.2000000000000001e110

    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 x around inf 78.1%

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

    if 9.2000000000000001e110 < y < 1.25000000000000002e183

    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 x around 0 82.2%

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

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

        \[\leadsto \left(y - \color{blue}{\left(-y \cdot \log \left(\frac{1}{y}\right)\right)}\right) - z \]
      2. distribute-rgt-neg-in82.2%

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

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

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

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

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

    if 1.25000000000000002e183 < y < 1.3e183

    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 z around inf 100.0%

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

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

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

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

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

      \[\leadsto \color{blue}{x} \]
  3. Recombined 6 regimes into one program.
  4. Final simplification79.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 1.42 \cdot 10^{-164}:\\ \;\;\;\;\log y \cdot -0.5 - z\\ \mathbf{elif}\;y \leq 4.8 \cdot 10^{-42}:\\ \;\;\;\;\left(x + y\right) - z\\ \mathbf{elif}\;y \leq 2.8 \cdot 10^{-18}:\\ \;\;\;\;\log y \cdot -0.5 - z\\ \mathbf{elif}\;y \leq 1.85 \cdot 10^{+20}:\\ \;\;\;\;\left(x + y\right) - z\\ \mathbf{elif}\;y \leq 1.45 \cdot 10^{+74}:\\ \;\;\;\;y \cdot \left(1 - \log y\right)\\ \mathbf{elif}\;y \leq 9.2 \cdot 10^{+110}:\\ \;\;\;\;x - z\\ \mathbf{elif}\;y \leq 1.25 \cdot 10^{+183}:\\ \;\;\;\;y - y \cdot \log y\\ \mathbf{elif}\;y \leq 1.3 \cdot 10^{+183}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(1 - \log y\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 74.4% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \log y \cdot -0.5 - z\\ t_1 := \left(x + y\right) - z\\ \mathbf{if}\;y \leq 1.4 \cdot 10^{-164}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq 5.5 \cdot 10^{-40}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 1.2 \cdot 10^{-17}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq 3.8 \cdot 10^{+18}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 1.18 \cdot 10^{+70} \lor \neg \left(y \leq 5.7 \cdot 10^{+85}\right) \land y \leq 5.4 \cdot 10^{+119}:\\ \;\;\;\;y \cdot \left(1 - \log y\right) - z\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \log \left(\frac{e}{y}\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (- (* (log y) -0.5) z)) (t_1 (- (+ x y) z)))
   (if (<= y 1.4e-164)
     t_0
     (if (<= y 5.5e-40)
       t_1
       (if (<= y 1.2e-17)
         t_0
         (if (<= y 3.8e+18)
           t_1
           (if (or (<= y 1.18e+70) (and (not (<= y 5.7e+85)) (<= y 5.4e+119)))
             (- (* y (- 1.0 (log y))) z)
             (+ x (* y (log (/ E y)))))))))))
double code(double x, double y, double z) {
	double t_0 = (log(y) * -0.5) - z;
	double t_1 = (x + y) - z;
	double tmp;
	if (y <= 1.4e-164) {
		tmp = t_0;
	} else if (y <= 5.5e-40) {
		tmp = t_1;
	} else if (y <= 1.2e-17) {
		tmp = t_0;
	} else if (y <= 3.8e+18) {
		tmp = t_1;
	} else if ((y <= 1.18e+70) || (!(y <= 5.7e+85) && (y <= 5.4e+119))) {
		tmp = (y * (1.0 - log(y))) - z;
	} else {
		tmp = x + (y * log((((double) M_E) / y)));
	}
	return tmp;
}
public static double code(double x, double y, double z) {
	double t_0 = (Math.log(y) * -0.5) - z;
	double t_1 = (x + y) - z;
	double tmp;
	if (y <= 1.4e-164) {
		tmp = t_0;
	} else if (y <= 5.5e-40) {
		tmp = t_1;
	} else if (y <= 1.2e-17) {
		tmp = t_0;
	} else if (y <= 3.8e+18) {
		tmp = t_1;
	} else if ((y <= 1.18e+70) || (!(y <= 5.7e+85) && (y <= 5.4e+119))) {
		tmp = (y * (1.0 - Math.log(y))) - z;
	} else {
		tmp = x + (y * Math.log((Math.E / y)));
	}
	return tmp;
}
def code(x, y, z):
	t_0 = (math.log(y) * -0.5) - z
	t_1 = (x + y) - z
	tmp = 0
	if y <= 1.4e-164:
		tmp = t_0
	elif y <= 5.5e-40:
		tmp = t_1
	elif y <= 1.2e-17:
		tmp = t_0
	elif y <= 3.8e+18:
		tmp = t_1
	elif (y <= 1.18e+70) or (not (y <= 5.7e+85) and (y <= 5.4e+119)):
		tmp = (y * (1.0 - math.log(y))) - z
	else:
		tmp = x + (y * math.log((math.e / y)))
	return tmp
function code(x, y, z)
	t_0 = Float64(Float64(log(y) * -0.5) - z)
	t_1 = Float64(Float64(x + y) - z)
	tmp = 0.0
	if (y <= 1.4e-164)
		tmp = t_0;
	elseif (y <= 5.5e-40)
		tmp = t_1;
	elseif (y <= 1.2e-17)
		tmp = t_0;
	elseif (y <= 3.8e+18)
		tmp = t_1;
	elseif ((y <= 1.18e+70) || (!(y <= 5.7e+85) && (y <= 5.4e+119)))
		tmp = Float64(Float64(y * Float64(1.0 - log(y))) - z);
	else
		tmp = Float64(x + Float64(y * log(Float64(exp(1) / y))));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = (log(y) * -0.5) - z;
	t_1 = (x + y) - z;
	tmp = 0.0;
	if (y <= 1.4e-164)
		tmp = t_0;
	elseif (y <= 5.5e-40)
		tmp = t_1;
	elseif (y <= 1.2e-17)
		tmp = t_0;
	elseif (y <= 3.8e+18)
		tmp = t_1;
	elseif ((y <= 1.18e+70) || (~((y <= 5.7e+85)) && (y <= 5.4e+119)))
		tmp = (y * (1.0 - log(y))) - z;
	else
		tmp = x + (y * log((2.71828182845904523536 / y)));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[Log[y], $MachinePrecision] * -0.5), $MachinePrecision] - z), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x + y), $MachinePrecision] - z), $MachinePrecision]}, If[LessEqual[y, 1.4e-164], t$95$0, If[LessEqual[y, 5.5e-40], t$95$1, If[LessEqual[y, 1.2e-17], t$95$0, If[LessEqual[y, 3.8e+18], t$95$1, If[Or[LessEqual[y, 1.18e+70], And[N[Not[LessEqual[y, 5.7e+85]], $MachinePrecision], LessEqual[y, 5.4e+119]]], N[(N[(y * N[(1.0 - N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], N[(x + N[(y * N[Log[N[(E / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq 5.5 \cdot 10^{-40}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y \leq 1.2 \cdot 10^{-17}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y \leq 3.8 \cdot 10^{+18}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y \leq 1.18 \cdot 10^{+70} \lor \neg \left(y \leq 5.7 \cdot 10^{+85}\right) \land y \leq 5.4 \cdot 10^{+119}:\\
\;\;\;\;y \cdot \left(1 - \log y\right) - z\\

\mathbf{else}:\\
\;\;\;\;x + y \cdot \log \left(\frac{e}{y}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < 1.4000000000000001e-164 or 5.50000000000000002e-40 < y < 1.19999999999999993e-17

    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. Step-by-step derivation
      1. *-commutative100.0%

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

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

      \[\leadsto \color{blue}{-0.5 \cdot \log y} - z \]
    7. Step-by-step derivation
      1. *-commutative78.9%

        \[\leadsto \color{blue}{\log y \cdot -0.5} - z \]
    8. Simplified78.9%

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

    if 1.4000000000000001e-164 < y < 5.50000000000000002e-40 or 1.19999999999999993e-17 < y < 3.8e18

    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 x around -inf 99.9%

      \[\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-neg99.9%

        \[\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-neg99.9%

        \[\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*99.9%

        \[\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. +-commutative99.9%

        \[\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-eval99.9%

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

      \[\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 x around inf 83.1%

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

        \[\leadsto \left(\left(-\color{blue}{\left(-x\right)}\right) + y\right) - z \]
    8. Simplified83.1%

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

    if 3.8e18 < y < 1.18000000000000001e70 or 5.7000000000000002e85 < y < 5.3999999999999997e119

    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 79.4%

      \[\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-neg79.4%

        \[\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-neg79.4%

        \[\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*79.6%

        \[\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. +-commutative79.6%

        \[\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-eval79.6%

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

      \[\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 89.9%

      \[\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-neg89.9%

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

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

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

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

    if 1.18000000000000001e70 < y < 5.7000000000000002e85 or 5.3999999999999997e119 < y

    1. Initial program 99.5%

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

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

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

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

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

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

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

      \[\leadsto z \cdot \left(\frac{x}{z} + \color{blue}{y \cdot \left(\frac{1}{z} - -1 \cdot \frac{\log \left(\frac{1}{y}\right)}{z}\right)}\right) \]
    8. Step-by-step derivation
      1. cancel-sign-sub-inv57.9%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{x + y \cdot \left(1 - \log y\right)} \]
    11. Step-by-step derivation
      1. +-commutative91.4%

        \[\leadsto \color{blue}{y \cdot \left(1 - \log y\right) + x} \]
    12. Simplified91.4%

      \[\leadsto \color{blue}{y \cdot \left(1 - \log y\right) + x} \]
    13. Step-by-step derivation
      1. add-log-exp99.6%

        \[\leadsto x + \left(y \cdot \color{blue}{\log \left(e^{1 - \log y}\right)} - z\right) \]
      2. exp-diff99.6%

        \[\leadsto x + \left(y \cdot \log \color{blue}{\left(\frac{e^{1}}{e^{\log y}}\right)} - z\right) \]
      3. add-exp-log99.6%

        \[\leadsto x + \left(y \cdot \log \left(\frac{e^{1}}{\color{blue}{y}}\right) - z\right) \]
    14. Applied egg-rr91.4%

      \[\leadsto y \cdot \color{blue}{\log \left(\frac{e^{1}}{y}\right)} + x \]
    15. Step-by-step derivation
      1. exp-1-e99.6%

        \[\leadsto x + \left(y \cdot \log \left(\frac{\color{blue}{e}}{y}\right) - z\right) \]
    16. Simplified91.4%

      \[\leadsto y \cdot \color{blue}{\log \left(\frac{e}{y}\right)} + x \]
  3. Recombined 4 regimes into one program.
  4. Final simplification85.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 1.4 \cdot 10^{-164}:\\ \;\;\;\;\log y \cdot -0.5 - z\\ \mathbf{elif}\;y \leq 5.5 \cdot 10^{-40}:\\ \;\;\;\;\left(x + y\right) - z\\ \mathbf{elif}\;y \leq 1.2 \cdot 10^{-17}:\\ \;\;\;\;\log y \cdot -0.5 - z\\ \mathbf{elif}\;y \leq 3.8 \cdot 10^{+18}:\\ \;\;\;\;\left(x + y\right) - z\\ \mathbf{elif}\;y \leq 1.18 \cdot 10^{+70} \lor \neg \left(y \leq 5.7 \cdot 10^{+85}\right) \land y \leq 5.4 \cdot 10^{+119}:\\ \;\;\;\;y \cdot \left(1 - \log y\right) - z\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \log \left(\frac{e}{y}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 72.7% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \log y \cdot -0.5 - z\\ \mathbf{if}\;y \leq 1.5 \cdot 10^{-164}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq 8.2 \cdot 10^{-40}:\\ \;\;\;\;\left(x + y\right) - z\\ \mathbf{elif}\;y \leq 3.2 \cdot 10^{-17}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \log \left(\frac{e}{y}\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (- (* (log y) -0.5) z)))
   (if (<= y 1.5e-164)
     t_0
     (if (<= y 8.2e-40)
       (- (+ x y) z)
       (if (<= y 3.2e-17) t_0 (+ x (* y (log (/ E y)))))))))
double code(double x, double y, double z) {
	double t_0 = (log(y) * -0.5) - z;
	double tmp;
	if (y <= 1.5e-164) {
		tmp = t_0;
	} else if (y <= 8.2e-40) {
		tmp = (x + y) - z;
	} else if (y <= 3.2e-17) {
		tmp = t_0;
	} else {
		tmp = x + (y * log((((double) M_E) / y)));
	}
	return tmp;
}
public static double code(double x, double y, double z) {
	double t_0 = (Math.log(y) * -0.5) - z;
	double tmp;
	if (y <= 1.5e-164) {
		tmp = t_0;
	} else if (y <= 8.2e-40) {
		tmp = (x + y) - z;
	} else if (y <= 3.2e-17) {
		tmp = t_0;
	} else {
		tmp = x + (y * Math.log((Math.E / y)));
	}
	return tmp;
}
def code(x, y, z):
	t_0 = (math.log(y) * -0.5) - z
	tmp = 0
	if y <= 1.5e-164:
		tmp = t_0
	elif y <= 8.2e-40:
		tmp = (x + y) - z
	elif y <= 3.2e-17:
		tmp = t_0
	else:
		tmp = x + (y * math.log((math.e / y)))
	return tmp
function code(x, y, z)
	t_0 = Float64(Float64(log(y) * -0.5) - z)
	tmp = 0.0
	if (y <= 1.5e-164)
		tmp = t_0;
	elseif (y <= 8.2e-40)
		tmp = Float64(Float64(x + y) - z);
	elseif (y <= 3.2e-17)
		tmp = t_0;
	else
		tmp = Float64(x + Float64(y * log(Float64(exp(1) / y))));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = (log(y) * -0.5) - z;
	tmp = 0.0;
	if (y <= 1.5e-164)
		tmp = t_0;
	elseif (y <= 8.2e-40)
		tmp = (x + y) - z;
	elseif (y <= 3.2e-17)
		tmp = t_0;
	else
		tmp = x + (y * log((2.71828182845904523536 / y)));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[Log[y], $MachinePrecision] * -0.5), $MachinePrecision] - z), $MachinePrecision]}, If[LessEqual[y, 1.5e-164], t$95$0, If[LessEqual[y, 8.2e-40], N[(N[(x + y), $MachinePrecision] - z), $MachinePrecision], If[LessEqual[y, 3.2e-17], t$95$0, N[(x + N[(y * N[Log[N[(E / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \log y \cdot -0.5 - z\\
\mathbf{if}\;y \leq 1.5 \cdot 10^{-164}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y \leq 8.2 \cdot 10^{-40}:\\
\;\;\;\;\left(x + y\right) - z\\

\mathbf{elif}\;y \leq 3.2 \cdot 10^{-17}:\\
\;\;\;\;t\_0\\

\mathbf{else}:\\
\;\;\;\;x + y \cdot \log \left(\frac{e}{y}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < 1.5e-164 or 8.19999999999999926e-40 < y < 3.2000000000000002e-17

    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. Step-by-step derivation
      1. *-commutative100.0%

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

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

      \[\leadsto \color{blue}{-0.5 \cdot \log y} - z \]
    7. Step-by-step derivation
      1. *-commutative78.9%

        \[\leadsto \color{blue}{\log y \cdot -0.5} - z \]
    8. Simplified78.9%

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

    if 1.5e-164 < y < 8.19999999999999926e-40

    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 x around -inf 99.9%

      \[\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-neg99.9%

        \[\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-neg99.9%

        \[\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*99.9%

        \[\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. +-commutative99.9%

        \[\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-eval99.9%

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

      \[\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 x around inf 83.6%

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

        \[\leadsto \left(\left(-\color{blue}{\left(-x\right)}\right) + y\right) - z \]
    8. Simplified83.6%

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

    if 3.2000000000000002e-17 < 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 z around inf 64.9%

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

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

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

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

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

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

      \[\leadsto z \cdot \left(\frac{x}{z} + \color{blue}{y \cdot \left(\frac{1}{z} - -1 \cdot \frac{\log \left(\frac{1}{y}\right)}{z}\right)}\right) \]
    8. Step-by-step derivation
      1. cancel-sign-sub-inv51.1%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{x + y \cdot \left(1 - \log y\right)} \]
    11. Step-by-step derivation
      1. +-commutative82.2%

        \[\leadsto \color{blue}{y \cdot \left(1 - \log y\right) + x} \]
    12. Simplified82.2%

      \[\leadsto \color{blue}{y \cdot \left(1 - \log y\right) + x} \]
    13. Step-by-step derivation
      1. add-log-exp97.8%

        \[\leadsto x + \left(y \cdot \color{blue}{\log \left(e^{1 - \log y}\right)} - z\right) \]
      2. exp-diff97.8%

        \[\leadsto x + \left(y \cdot \log \color{blue}{\left(\frac{e^{1}}{e^{\log y}}\right)} - z\right) \]
      3. add-exp-log97.8%

        \[\leadsto x + \left(y \cdot \log \left(\frac{e^{1}}{\color{blue}{y}}\right) - z\right) \]
    14. Applied egg-rr82.2%

      \[\leadsto y \cdot \color{blue}{\log \left(\frac{e^{1}}{y}\right)} + x \]
    15. Step-by-step derivation
      1. exp-1-e97.8%

        \[\leadsto x + \left(y \cdot \log \left(\frac{\color{blue}{e}}{y}\right) - z\right) \]
    16. Simplified82.2%

      \[\leadsto y \cdot \color{blue}{\log \left(\frac{e}{y}\right)} + x \]
  3. Recombined 3 regimes into one program.
  4. Final simplification81.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 1.5 \cdot 10^{-164}:\\ \;\;\;\;\log y \cdot -0.5 - z\\ \mathbf{elif}\;y \leq 8.2 \cdot 10^{-40}:\\ \;\;\;\;\left(x + y\right) - z\\ \mathbf{elif}\;y \leq 3.2 \cdot 10^{-17}:\\ \;\;\;\;\log y \cdot -0.5 - z\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \log \left(\frac{e}{y}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 69.2% accurate, 0.9× speedup?

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

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

\mathbf{elif}\;y \leq 1.9 \cdot 10^{+74} \lor \neg \left(y \leq 1.02 \cdot 10^{+111}\right):\\
\;\;\;\;y \cdot \left(1 - \log y\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < 1.85e20

    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 x around -inf 99.9%

      \[\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-neg99.9%

        \[\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-neg99.9%

        \[\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*99.8%

        \[\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. +-commutative99.8%

        \[\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-eval99.8%

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

      \[\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 x around inf 75.1%

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

        \[\leadsto \left(\left(-\color{blue}{\left(-x\right)}\right) + y\right) - z \]
    8. Simplified75.1%

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

    if 1.85e20 < y < 1.8999999999999999e74 or 1.02e111 < y

    1. Initial program 99.4%

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

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

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

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

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

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

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

      \[\leadsto z \cdot \left(\frac{x}{z} + \color{blue}{y \cdot \left(\frac{1}{z} - -1 \cdot \frac{\log \left(\frac{1}{y}\right)}{z}\right)}\right) \]
    8. Step-by-step derivation
      1. cancel-sign-sub-inv55.4%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto z \cdot \left(\frac{x}{z} + \color{blue}{\frac{y}{\frac{z}{1 - \log y}}}\right) \]
    12. Step-by-step derivation
      1. associate-/r/55.4%

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

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

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

    if 1.8999999999999999e74 < y < 1.02e111

    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 x around inf 78.1%

      \[\leadsto \color{blue}{x} - z \]
  3. Recombined 3 regimes into one program.
  4. Final simplification75.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 1.85 \cdot 10^{+20}:\\ \;\;\;\;\left(x + y\right) - z\\ \mathbf{elif}\;y \leq 1.9 \cdot 10^{+74} \lor \neg \left(y \leq 1.02 \cdot 10^{+111}\right):\\ \;\;\;\;y \cdot \left(1 - \log y\right)\\ \mathbf{else}:\\ \;\;\;\;x - z\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 89.9% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 1.15 \cdot 10^{+20}:\\ \;\;\;\;\left(x - \log y \cdot 0.5\right) - z\\ \mathbf{elif}\;y \leq 3.5 \cdot 10^{+128}:\\ \;\;\;\;y \cdot \left(1 - \log y\right) - z\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \log \left(\frac{e}{y}\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y 1.15e+20)
   (- (- x (* (log y) 0.5)) z)
   (if (<= y 3.5e+128) (- (* y (- 1.0 (log y))) z) (+ x (* y (log (/ E y)))))))
double code(double x, double y, double z) {
	double tmp;
	if (y <= 1.15e+20) {
		tmp = (x - (log(y) * 0.5)) - z;
	} else if (y <= 3.5e+128) {
		tmp = (y * (1.0 - log(y))) - z;
	} else {
		tmp = x + (y * log((((double) M_E) / y)));
	}
	return tmp;
}
public static double code(double x, double y, double z) {
	double tmp;
	if (y <= 1.15e+20) {
		tmp = (x - (Math.log(y) * 0.5)) - z;
	} else if (y <= 3.5e+128) {
		tmp = (y * (1.0 - Math.log(y))) - z;
	} else {
		tmp = x + (y * Math.log((Math.E / y)));
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= 1.15e+20:
		tmp = (x - (math.log(y) * 0.5)) - z
	elif y <= 3.5e+128:
		tmp = (y * (1.0 - math.log(y))) - z
	else:
		tmp = x + (y * math.log((math.e / y)))
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= 1.15e+20)
		tmp = Float64(Float64(x - Float64(log(y) * 0.5)) - z);
	elseif (y <= 3.5e+128)
		tmp = Float64(Float64(y * Float64(1.0 - log(y))) - z);
	else
		tmp = Float64(x + Float64(y * log(Float64(exp(1) / y))));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= 1.15e+20)
		tmp = (x - (log(y) * 0.5)) - z;
	elseif (y <= 3.5e+128)
		tmp = (y * (1.0 - log(y))) - z;
	else
		tmp = x + (y * log((2.71828182845904523536 / y)));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, 1.15e+20], N[(N[(x - N[(N[Log[y], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], If[LessEqual[y, 3.5e+128], N[(N[(y * N[(1.0 - N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], N[(x + N[(y * N[Log[N[(E / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq 3.5 \cdot 10^{+128}:\\
\;\;\;\;y \cdot \left(1 - \log y\right) - z\\

\mathbf{else}:\\
\;\;\;\;x + y \cdot \log \left(\frac{e}{y}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < 1.15e20

    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 99.3%

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

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

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

    if 1.15e20 < y < 3.49999999999999969e128

    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 83.7%

      \[\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-neg83.7%

        \[\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-neg83.7%

        \[\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*83.7%

        \[\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. +-commutative83.7%

        \[\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-eval83.7%

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

      \[\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 84.1%

      \[\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-neg84.1%

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

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

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

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

    if 3.49999999999999969e128 < y

    1. Initial program 99.5%

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

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

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

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

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

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

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

      \[\leadsto z \cdot \left(\frac{x}{z} + \color{blue}{y \cdot \left(\frac{1}{z} - -1 \cdot \frac{\log \left(\frac{1}{y}\right)}{z}\right)}\right) \]
    8. Step-by-step derivation
      1. cancel-sign-sub-inv56.8%

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{y \cdot \left(1 - \log y\right) + x} \]
    12. Simplified92.9%

      \[\leadsto \color{blue}{y \cdot \left(1 - \log y\right) + x} \]
    13. Step-by-step derivation
      1. add-log-exp99.6%

        \[\leadsto x + \left(y \cdot \color{blue}{\log \left(e^{1 - \log y}\right)} - z\right) \]
      2. exp-diff99.6%

        \[\leadsto x + \left(y \cdot \log \color{blue}{\left(\frac{e^{1}}{e^{\log y}}\right)} - z\right) \]
      3. add-exp-log99.6%

        \[\leadsto x + \left(y \cdot \log \left(\frac{e^{1}}{\color{blue}{y}}\right) - z\right) \]
    14. Applied egg-rr92.9%

      \[\leadsto y \cdot \color{blue}{\log \left(\frac{e^{1}}{y}\right)} + x \]
    15. Step-by-step derivation
      1. exp-1-e99.6%

        \[\leadsto x + \left(y \cdot \log \left(\frac{\color{blue}{e}}{y}\right) - z\right) \]
    16. Simplified92.9%

      \[\leadsto y \cdot \color{blue}{\log \left(\frac{e}{y}\right)} + x \]
  3. Recombined 3 regimes into one program.
  4. Final simplification95.7%

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

Alternative 7: 99.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 1.1 \cdot 10^{-5}:\\ \;\;\;\;\left(x - \log y \cdot 0.5\right) - z\\ \mathbf{else}:\\ \;\;\;\;x + \left(y \cdot \log \left(\frac{e}{y}\right) - z\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y 1.1e-5)
   (- (- x (* (log y) 0.5)) z)
   (+ x (- (* y (log (/ E y))) z))))
double code(double x, double y, double z) {
	double tmp;
	if (y <= 1.1e-5) {
		tmp = (x - (log(y) * 0.5)) - z;
	} else {
		tmp = x + ((y * log((((double) M_E) / y))) - z);
	}
	return tmp;
}
public static double code(double x, double y, double z) {
	double tmp;
	if (y <= 1.1e-5) {
		tmp = (x - (Math.log(y) * 0.5)) - z;
	} else {
		tmp = x + ((y * Math.log((Math.E / y))) - z);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= 1.1e-5:
		tmp = (x - (math.log(y) * 0.5)) - z
	else:
		tmp = x + ((y * math.log((math.e / y))) - z)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= 1.1e-5)
		tmp = Float64(Float64(x - Float64(log(y) * 0.5)) - z);
	else
		tmp = Float64(x + Float64(Float64(y * log(Float64(exp(1) / y))) - z));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= 1.1e-5)
		tmp = (x - (log(y) * 0.5)) - z;
	else
		tmp = x + ((y * log((2.71828182845904523536 / y))) - z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, 1.1e-5], N[(N[(x - N[(N[Log[y], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], N[(x + N[(N[(y * N[Log[N[(E / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 1.1e-5

    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 99.9%

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

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

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

    if 1.1e-5 < 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.5%

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

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

        \[\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.6%

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

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

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

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

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

      \[\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 99.4%

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

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

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

      \[\leadsto x + \left(\color{blue}{y \cdot \left(1 - \log y\right)} - z\right) \]
    8. Step-by-step derivation
      1. add-log-exp99.4%

        \[\leadsto x + \left(y \cdot \color{blue}{\log \left(e^{1 - \log y}\right)} - z\right) \]
      2. exp-diff99.4%

        \[\leadsto x + \left(y \cdot \log \color{blue}{\left(\frac{e^{1}}{e^{\log y}}\right)} - z\right) \]
      3. add-exp-log99.4%

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

      \[\leadsto x + \left(y \cdot \color{blue}{\log \left(\frac{e^{1}}{y}\right)} - z\right) \]
    10. Step-by-step derivation
      1. exp-1-e99.4%

        \[\leadsto x + \left(y \cdot \log \left(\frac{\color{blue}{e}}{y}\right) - z\right) \]
    11. Simplified99.4%

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

Alternative 8: 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 9: 47.9% accurate, 5.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -1.1 \cdot 10^{+88} \lor \neg \left(z \leq 1.22 \cdot 10^{+39}\right) \land \left(z \leq 7 \cdot 10^{+66} \lor \neg \left(z \leq 1.4 \cdot 10^{+70}\right)\right):\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= z -1.1e+88)
         (and (not (<= z 1.22e+39)) (or (<= z 7e+66) (not (<= z 1.4e+70)))))
   (- z)
   x))
double code(double x, double y, double z) {
	double tmp;
	if ((z <= -1.1e+88) || (!(z <= 1.22e+39) && ((z <= 7e+66) || !(z <= 1.4e+70)))) {
		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 ((z <= (-1.1d+88)) .or. (.not. (z <= 1.22d+39)) .and. (z <= 7d+66) .or. (.not. (z <= 1.4d+70))) 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 ((z <= -1.1e+88) || (!(z <= 1.22e+39) && ((z <= 7e+66) || !(z <= 1.4e+70)))) {
		tmp = -z;
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (z <= -1.1e+88) or (not (z <= 1.22e+39) and ((z <= 7e+66) or not (z <= 1.4e+70))):
		tmp = -z
	else:
		tmp = x
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((z <= -1.1e+88) || (!(z <= 1.22e+39) && ((z <= 7e+66) || !(z <= 1.4e+70))))
		tmp = Float64(-z);
	else
		tmp = x;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((z <= -1.1e+88) || (~((z <= 1.22e+39)) && ((z <= 7e+66) || ~((z <= 1.4e+70)))))
		tmp = -z;
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.1e+88], And[N[Not[LessEqual[z, 1.22e+39]], $MachinePrecision], Or[LessEqual[z, 7e+66], N[Not[LessEqual[z, 1.4e+70]], $MachinePrecision]]]], (-z), x]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.1 \cdot 10^{+88} \lor \neg \left(z \leq 1.22 \cdot 10^{+39}\right) \land \left(z \leq 7 \cdot 10^{+66} \lor \neg \left(z \leq 1.4 \cdot 10^{+70}\right)\right):\\
\;\;\;\;-z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.10000000000000004e88 or 1.22e39 < z < 6.9999999999999994e66 or 1.39999999999999995e70 < 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. Taylor expanded in x around 0 83.0%

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

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

        \[\leadsto \color{blue}{-z} \]
    6. Simplified66.1%

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

    if -1.10000000000000004e88 < z < 1.22e39 or 6.9999999999999994e66 < z < 1.39999999999999995e70

    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 z around inf 62.8%

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

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

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

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

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

      \[\leadsto \color{blue}{x} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification47.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.1 \cdot 10^{+88} \lor \neg \left(z \leq 1.22 \cdot 10^{+39}\right) \land \left(z \leq 7 \cdot 10^{+66} \lor \neg \left(z \leq 1.4 \cdot 10^{+70}\right)\right):\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 57.8% 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. Taylor expanded in x around inf 57.2%

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

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

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

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

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

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

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

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

Developer target: 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 2024107 
(FPCore (x y z)
  :name "Numeric.SpecFunctions:stirlingError from math-functions-0.1.5.2"
  :precision binary64

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

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