Numeric.SpecFunctions:stirlingError from math-functions-0.1.5.2

Percentage Accurate: 99.8% → 99.9%
Time: 12.3s
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. Final simplification99.8%

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

Alternative 2: 74.6% accurate, 0.8× speedup?

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

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

\mathbf{elif}\;z \leq -6 \cdot 10^{-111}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq -1.45 \cdot 10^{-151}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq -1.4 \cdot 10^{-190}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq 4 \cdot 10^{+104}:\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -80 or 4e104 < z

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

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

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

        \[\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 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. Taylor expanded in y around 0 85.7%

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

    if -80 < z < -6.00000000000000016e-111 or -1.45000000000000006e-151 < z < -1.40000000000000003e-190

    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.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 z around 0 90.4%

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

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

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

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

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

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

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

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

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

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

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

    if -6.00000000000000016e-111 < z < -1.45000000000000006e-151 or -1.40000000000000003e-190 < z < 4e104

    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 y around inf 84.3%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -80:\\ \;\;\;\;x - z\\ \mathbf{elif}\;z \leq -6 \cdot 10^{-111}:\\ \;\;\;\;y - \log y \cdot \left(y + 0.5\right)\\ \mathbf{elif}\;z \leq -1.45 \cdot 10^{-151}:\\ \;\;\;\;x + y \cdot \left(1 - \log y\right)\\ \mathbf{elif}\;z \leq -1.4 \cdot 10^{-190}:\\ \;\;\;\;y - \log y \cdot \left(y + 0.5\right)\\ \mathbf{elif}\;z \leq 4 \cdot 10^{+104}:\\ \;\;\;\;x + y \cdot \left(1 - \log y\right)\\ \mathbf{else}:\\ \;\;\;\;x - z\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 74.3% accurate, 0.8× speedup?

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

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

\mathbf{elif}\;x \leq -8.5 \cdot 10^{-272}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq 1.6 \cdot 10^{-288}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq 9 \cdot 10^{-145}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq 4700000000000:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -1.55e111

    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+100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.55e111 < x < -8.5000000000000001e-272 or 1.6e-288 < x < 9.0000000000000001e-145

    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. add-cube-cbrt98.8%

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

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

        \[\leadsto \left({\left(\sqrt[3]{\color{blue}{x + \left(-\left(y + 0.5\right) \cdot \log y\right)}}\right)}^{3} + y\right) - z \]
      4. *-commutative98.8%

        \[\leadsto \left({\left(\sqrt[3]{x + \left(-\color{blue}{\log y \cdot \left(y + 0.5\right)}\right)}\right)}^{3} + y\right) - z \]
      5. distribute-rgt-neg-in98.8%

        \[\leadsto \left({\left(\sqrt[3]{x + \color{blue}{\log y \cdot \left(-\left(y + 0.5\right)\right)}}\right)}^{3} + y\right) - z \]
      6. +-commutative98.8%

        \[\leadsto \left({\left(\sqrt[3]{x + \log y \cdot \left(-\color{blue}{\left(0.5 + y\right)}\right)}\right)}^{3} + y\right) - z \]
      7. distribute-neg-in98.8%

        \[\leadsto \left({\left(\sqrt[3]{x + \log y \cdot \color{blue}{\left(\left(-0.5\right) + \left(-y\right)\right)}}\right)}^{3} + y\right) - z \]
      8. metadata-eval98.8%

        \[\leadsto \left({\left(\sqrt[3]{x + \log y \cdot \left(\color{blue}{-0.5} + \left(-y\right)\right)}\right)}^{3} + y\right) - z \]
      9. sub-neg98.8%

        \[\leadsto \left({\left(\sqrt[3]{x + \log y \cdot \color{blue}{\left(-0.5 - y\right)}}\right)}^{3} + y\right) - z \]
    4. Applied egg-rr98.8%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto y \cdot \log \left(\frac{\color{blue}{e}}{y}\right) - z \]
    11. Simplified79.0%

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

    if -8.5000000000000001e-272 < x < 1.6e-288 or 9.0000000000000001e-145 < x < 4.7e12

    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 z around 0 88.4%

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

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

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

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

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

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

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

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

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

        \[\leadsto y - \log y \cdot \color{blue}{\left(y + 0.5\right)} \]
    10. Simplified88.4%

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

    if 4.7e12 < 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 y around inf 99.9%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.55 \cdot 10^{+111}:\\ \;\;\;\;x + y \cdot \left(1 - \log y\right)\\ \mathbf{elif}\;x \leq -8.5 \cdot 10^{-272}:\\ \;\;\;\;y \cdot \log \left(\frac{e}{y}\right) - z\\ \mathbf{elif}\;x \leq 1.6 \cdot 10^{-288}:\\ \;\;\;\;y - \log y \cdot \left(y + 0.5\right)\\ \mathbf{elif}\;x \leq 9 \cdot 10^{-145}:\\ \;\;\;\;y \cdot \log \left(\frac{e}{y}\right) - z\\ \mathbf{elif}\;x \leq 4700000000000:\\ \;\;\;\;y - \log y \cdot \left(y + 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;x - z\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 89.3% accurate, 0.9× speedup?

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

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

\mathbf{elif}\;y \leq 1.16 \cdot 10^{+29}:\\
\;\;\;\;t\_0\\

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

\mathbf{elif}\;y \leq 9.5 \cdot 10^{+123}:\\
\;\;\;\;t\_0\\

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


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

    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 \]

    if 45000 < y < 1.16e29 or 4.9000000000000003e48 < y < 9.4999999999999996e123

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

    if 1.16e29 < y < 4.9000000000000003e48

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 9.4999999999999996e123 < 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. Step-by-step derivation
      1. add-cube-cbrt98.4%

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

        \[\leadsto \left(\color{blue}{{\left(\sqrt[3]{x - \left(y + 0.5\right) \cdot \log y}\right)}^{3}} + y\right) - z \]
      3. sub-neg98.3%

        \[\leadsto \left({\left(\sqrt[3]{\color{blue}{x + \left(-\left(y + 0.5\right) \cdot \log y\right)}}\right)}^{3} + y\right) - z \]
      4. *-commutative98.3%

        \[\leadsto \left({\left(\sqrt[3]{x + \left(-\color{blue}{\log y \cdot \left(y + 0.5\right)}\right)}\right)}^{3} + y\right) - z \]
      5. distribute-rgt-neg-in98.3%

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

        \[\leadsto \left({\left(\sqrt[3]{x + \log y \cdot \left(-\color{blue}{\left(0.5 + y\right)}\right)}\right)}^{3} + y\right) - z \]
      7. distribute-neg-in98.3%

        \[\leadsto \left({\left(\sqrt[3]{x + \log y \cdot \color{blue}{\left(\left(-0.5\right) + \left(-y\right)\right)}}\right)}^{3} + y\right) - z \]
      8. metadata-eval98.3%

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

        \[\leadsto \left({\left(\sqrt[3]{x + \log y \cdot \color{blue}{\left(-0.5 - y\right)}}\right)}^{3} + y\right) - z \]
    4. Applied egg-rr98.3%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto y \cdot \log \left(\frac{\color{blue}{e}}{y}\right) - z \]
    11. Simplified91.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 45000:\\ \;\;\;\;\left(x - \log y \cdot 0.5\right) - z\\ \mathbf{elif}\;y \leq 1.16 \cdot 10^{+29}:\\ \;\;\;\;x + y \cdot \left(1 - \log y\right)\\ \mathbf{elif}\;y \leq 4.9 \cdot 10^{+48}:\\ \;\;\;\;x - z\\ \mathbf{elif}\;y \leq 9.5 \cdot 10^{+123}:\\ \;\;\;\;x + y \cdot \left(1 - \log y\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \log \left(\frac{e}{y}\right) - z\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 76.6% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.05 \cdot 10^{+68} \lor \neg \left(z \leq 1.2 \cdot 10^{+106}\right):\\
\;\;\;\;x - z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -2.05e68 or 1.2e106 < z

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.05e68 < z < 1.2e106

    1. Initial program 99.7%

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

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

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

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

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

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

        \[\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 y around inf 79.9%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.05 \cdot 10^{+68} \lor \neg \left(z \leq 1.2 \cdot 10^{+106}\right):\\ \;\;\;\;x - z\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \left(1 - \log y\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 99.3% accurate, 1.0× speedup?

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

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

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


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

    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 \]

    if 2.7e-10 < 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 98.6%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 2.7 \cdot 10^{-10}:\\ \;\;\;\;\left(x - \log y \cdot 0.5\right) - z\\ \mathbf{else}:\\ \;\;\;\;x + \left(y \cdot \left(1 - \log y\right) - z\right)\\ \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: 69.9% accurate, 1.0× speedup?

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

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

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


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

    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. add-cube-cbrt98.5%

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

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

        \[\leadsto \left({\left(\sqrt[3]{\color{blue}{x + \left(-\left(y + 0.5\right) \cdot \log y\right)}}\right)}^{3} + y\right) - z \]
      4. *-commutative98.5%

        \[\leadsto \left({\left(\sqrt[3]{x + \left(-\color{blue}{\log y \cdot \left(y + 0.5\right)}\right)}\right)}^{3} + y\right) - z \]
      5. distribute-rgt-neg-in98.5%

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

        \[\leadsto \left({\left(\sqrt[3]{x + \log y \cdot \left(-\color{blue}{\left(0.5 + y\right)}\right)}\right)}^{3} + y\right) - z \]
      7. distribute-neg-in98.5%

        \[\leadsto \left({\left(\sqrt[3]{x + \log y \cdot \color{blue}{\left(\left(-0.5\right) + \left(-y\right)\right)}}\right)}^{3} + y\right) - z \]
      8. metadata-eval98.5%

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

        \[\leadsto \left({\left(\sqrt[3]{x + \log y \cdot \color{blue}{\left(-0.5 - y\right)}}\right)}^{3} + y\right) - z \]
    4. Applied egg-rr98.5%

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

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

    if 4.59999999999999994e50 < 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 z around 0 83.8%

      \[\leadsto \color{blue}{x + \left(y + -1 \cdot \left(\log y \cdot \left(0.5 + y\right)\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg83.8%

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

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

        \[\leadsto \color{blue}{\left(x + y\right) - \log y \cdot \left(0.5 + y\right)} \]
      4. +-commutative83.8%

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

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

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

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

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

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

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

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

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

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

Alternative 9: 46.8% accurate, 9.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -8.2 \cdot 10^{+102}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 3.4 \cdot 10^{+157}:\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= x -8.2e+102) x (if (<= x 3.4e+157) (- z) x)))
double code(double x, double y, double z) {
	double tmp;
	if (x <= -8.2e+102) {
		tmp = x;
	} else if (x <= 3.4e+157) {
		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 <= (-8.2d+102)) then
        tmp = x
    else if (x <= 3.4d+157) 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 <= -8.2e+102) {
		tmp = x;
	} else if (x <= 3.4e+157) {
		tmp = -z;
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if x <= -8.2e+102:
		tmp = x
	elif x <= 3.4e+157:
		tmp = -z
	else:
		tmp = x
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (x <= -8.2e+102)
		tmp = x;
	elseif (x <= 3.4e+157)
		tmp = Float64(-z);
	else
		tmp = x;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (x <= -8.2e+102)
		tmp = x;
	elseif (x <= 3.4e+157)
		tmp = -z;
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[x, -8.2e+102], x, If[LessEqual[x, 3.4e+157], (-z), x]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq 3.4 \cdot 10^{+157}:\\
\;\;\;\;-z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -8.1999999999999999e102 or 3.39999999999999979e157 < 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+100.0%

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

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

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

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

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

    if -8.1999999999999999e102 < x < 3.39999999999999979e157

    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. add-cube-cbrt98.7%

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

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

        \[\leadsto \left({\left(\sqrt[3]{\color{blue}{x + \left(-\left(y + 0.5\right) \cdot \log y\right)}}\right)}^{3} + y\right) - z \]
      4. *-commutative98.6%

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

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

        \[\leadsto \left({\left(\sqrt[3]{x + \log y \cdot \left(-\color{blue}{\left(0.5 + y\right)}\right)}\right)}^{3} + y\right) - z \]
      7. distribute-neg-in98.6%

        \[\leadsto \left({\left(\sqrt[3]{x + \log y \cdot \color{blue}{\left(\left(-0.5\right) + \left(-y\right)\right)}}\right)}^{3} + y\right) - z \]
      8. metadata-eval98.6%

        \[\leadsto \left({\left(\sqrt[3]{x + \log y \cdot \left(\color{blue}{-0.5} + \left(-y\right)\right)}\right)}^{3} + y\right) - z \]
      9. sub-neg98.6%

        \[\leadsto \left({\left(\sqrt[3]{x + \log y \cdot \color{blue}{\left(-0.5 - y\right)}}\right)}^{3} + y\right) - z \]
    4. Applied egg-rr98.6%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-z} \]
    10. Simplified33.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -8.2 \cdot 10^{+102}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 3.4 \cdot 10^{+157}:\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 57.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. 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 y around inf 85.9%

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

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

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

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

    \[\leadsto \color{blue}{x - z} \]
  9. Final simplification54.5%

    \[\leadsto x - z \]
  10. Add Preprocessing

Alternative 11: 29.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.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 inf 30.6%

    \[\leadsto \color{blue}{x} \]
  6. Final simplification30.6%

    \[\leadsto 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 2024082 
(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))