Statistics.Distribution.Beta:$cdensity from math-functions-0.1.5.2

Percentage Accurate: 89.8% → 99.8%
Time: 19.0s
Alternatives: 20
Speedup: 1.9×

Specification

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

\\
\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t
\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 20 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: 89.8% accurate, 1.0× speedup?

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

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

Alternative 1: 99.8% accurate, 0.7× speedup?

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

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

    \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
  2. Step-by-step derivation
    1. +-commutative88.1%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(z - 1, \log \left(1 - y\right), \left(x - 1\right) \cdot \log y\right)} - t \]
    3. sub-neg88.1%

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

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

      \[\leadsto \mathsf{fma}\left(z + -1, \log \color{blue}{\left(1 + \left(-y\right)\right)}, \left(x - 1\right) \cdot \log y\right) - t \]
    6. log1p-def99.8%

      \[\leadsto \mathsf{fma}\left(z + -1, \color{blue}{\mathsf{log1p}\left(-y\right)}, \left(x - 1\right) \cdot \log y\right) - t \]
    7. sub-neg99.8%

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

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(z + -1, \mathsf{log1p}\left(-y\right), \left(x + -1\right) \cdot \log y\right) - t} \]
  4. Add Preprocessing
  5. Final simplification99.8%

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

Alternative 2: 99.8% accurate, 1.0× speedup?

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

\\
\left(\mathsf{log1p}\left(-y\right) \cdot \left(z + -1\right) + \log y \cdot \left(-1 + x\right)\right) - t
\end{array}
Derivation
  1. Initial program 88.1%

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

    \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\left(-1 \cdot \log \left(1 - y\right) + z \cdot \log \left(1 - y\right)\right)}\right) - t \]
  4. Step-by-step derivation
    1. distribute-rgt-out88.1%

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

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

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \log \left(1 + \color{blue}{-1 \cdot y}\right) \cdot \left(-1 + z\right)\right) - t \]
    4. log1p-def99.8%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\mathsf{log1p}\left(-1 \cdot y\right)} \cdot \left(-1 + z\right)\right) - t \]
    5. mul-1-neg99.8%

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

    \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\mathsf{log1p}\left(-y\right) \cdot \left(-1 + z\right)}\right) - t \]
  6. Final simplification99.8%

    \[\leadsto \left(\mathsf{log1p}\left(-y\right) \cdot \left(z + -1\right) + \log y \cdot \left(-1 + x\right)\right) - t \]
  7. Add Preprocessing

Alternative 3: 99.1% accurate, 1.0× speedup?

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

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

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

    \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\left(-1 \cdot \log \left(1 - y\right) + z \cdot \log \left(1 - y\right)\right)}\right) - t \]
  4. Step-by-step derivation
    1. distribute-rgt-out88.1%

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

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

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \log \left(1 + \color{blue}{-1 \cdot y}\right) \cdot \left(-1 + z\right)\right) - t \]
    4. log1p-def99.8%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\mathsf{log1p}\left(-1 \cdot y\right)} \cdot \left(-1 + z\right)\right) - t \]
    5. mul-1-neg99.8%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(y \cdot \color{blue}{\left(1 - z\right)} + \log y \cdot \left(x - 1\right)\right) - t \]
    9. fma-def98.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, 1 - z, \log y \cdot \left(x - 1\right)\right)} - t \]
    10. sub-neg98.8%

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

      \[\leadsto \mathsf{fma}\left(y, 1 - z, \log y \cdot \left(x + \color{blue}{-1}\right)\right) - t \]
    12. +-commutative98.8%

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(y, 1 - z, \log y \cdot \left(-1 + x\right)\right)} - t \]
  9. Final simplification98.8%

    \[\leadsto \mathsf{fma}\left(y, 1 - z, \left(-1 + x\right) \cdot \log y\right) - t \]
  10. Add Preprocessing

Alternative 4: 95.2% accurate, 1.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;-1 + x \leq -4 \cdot 10^{+30}:\\
\;\;\;\;x \cdot \log y - t\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (-.f64 x 1) < -4.0000000000000001e30

    1. Initial program 95.2%

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

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\left(-1 \cdot \log \left(1 - y\right) + z \cdot \log \left(1 - y\right)\right)}\right) - t \]
    4. Step-by-step derivation
      1. distribute-rgt-out95.2%

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

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \log y} - t \]
    7. Step-by-step derivation
      1. *-commutative93.9%

        \[\leadsto \color{blue}{\log y \cdot x} - t \]
    8. Simplified93.9%

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

    if -4.0000000000000001e30 < (-.f64 x 1) < -1

    1. Initial program 79.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\color{blue}{-1 \cdot \log y} - y \cdot \left(-1 + z\right)\right) - t \]
    7. Step-by-step derivation
      1. mul-1-neg97.2%

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

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

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

      \[\leadsto \color{blue}{-1 \cdot t + \left(-1 \cdot \log y + y \cdot \left(1 - z\right)\right)} \]
    11. Step-by-step derivation
      1. neg-mul-197.2%

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

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

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

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

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

        \[\leadsto \left(-t\right) + \left(\left(-\log y\right) + \color{blue}{\left(-y \cdot \left(-1 + z\right)\right)}\right) \]
      7. sub-neg97.2%

        \[\leadsto \left(-t\right) + \color{blue}{\left(\left(-\log y\right) - y \cdot \left(-1 + z\right)\right)} \]
      8. associate-+r-97.2%

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

        \[\leadsto \left(\left(-t\right) + \color{blue}{-1 \cdot \log y}\right) - y \cdot \left(-1 + z\right) \]
      10. remove-double-neg97.2%

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

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

        \[\leadsto \left(\left(-t\right) + -1 \cdot \left(-1 \cdot \color{blue}{\log \left(\frac{1}{y}\right)}\right)\right) - y \cdot \left(-1 + z\right) \]
      13. neg-mul-197.2%

        \[\leadsto \left(\color{blue}{-1 \cdot t} + -1 \cdot \left(-1 \cdot \log \left(\frac{1}{y}\right)\right)\right) - y \cdot \left(-1 + z\right) \]
      14. distribute-lft-in97.2%

        \[\leadsto \color{blue}{-1 \cdot \left(t + -1 \cdot \log \left(\frac{1}{y}\right)\right)} - y \cdot \left(-1 + z\right) \]
      15. unsub-neg97.2%

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

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

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

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

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

    if -1 < (-.f64 x 1)

    1. Initial program 97.8%

      \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
    2. Step-by-step derivation
      1. +-commutative97.8%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(z - 1, \log \left(1 - y\right), \left(x - 1\right) \cdot \log y\right)} - t \]
      3. sub-neg97.8%

        \[\leadsto \mathsf{fma}\left(\color{blue}{z + \left(-1\right)}, \log \left(1 - y\right), \left(x - 1\right) \cdot \log y\right) - t \]
      4. metadata-eval97.8%

        \[\leadsto \mathsf{fma}\left(z + \color{blue}{-1}, \log \left(1 - y\right), \left(x - 1\right) \cdot \log y\right) - t \]
      5. sub-neg97.8%

        \[\leadsto \mathsf{fma}\left(z + -1, \log \color{blue}{\left(1 + \left(-y\right)\right)}, \left(x - 1\right) \cdot \log y\right) - t \]
      6. log1p-def99.7%

        \[\leadsto \mathsf{fma}\left(z + -1, \color{blue}{\mathsf{log1p}\left(-y\right)}, \left(x - 1\right) \cdot \log y\right) - t \]
      7. sub-neg99.7%

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

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

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

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

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

Alternative 5: 86.3% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
t_1 := x \cdot \log y - t\\
\mathbf{if}\;x \leq -1:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq 5.2 \cdot 10^{-70}:\\
\;\;\;\;y - \left(\log y + t\right)\\

\mathbf{elif}\;x \leq 3.2 \cdot 10^{-15}:\\
\;\;\;\;y \cdot \left(1 - z\right) - \log y\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1 or 3.1999999999999999e-15 < x

    1. Initial program 94.8%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \log y} - t \]
    7. Step-by-step derivation
      1. *-commutative94.0%

        \[\leadsto \color{blue}{\log y \cdot x} - t \]
    8. Simplified94.0%

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

    if -1 < x < 5.20000000000000004e-70

    1. Initial program 82.0%

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

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

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

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

        \[\leadsto \left(\log y \cdot \left(x + \color{blue}{-1}\right) + -1 \cdot \left(y \cdot \left(z - 1\right)\right)\right) - t \]
      4. *-commutative98.0%

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

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

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

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

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

        \[\leadsto \left(\log y \cdot \left(-1 + x\right) - y \cdot \color{blue}{\left(z + \left(-1\right)\right)}\right) - t \]
      10. metadata-eval98.0%

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

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

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

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

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

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

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

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

        \[\leadsto y + \color{blue}{\left(-\left(t + \log y\right)\right)} \]
      2. +-commutative79.2%

        \[\leadsto y + \left(-\color{blue}{\left(\log y + t\right)}\right) \]
      3. unsub-neg79.2%

        \[\leadsto \color{blue}{y - \left(\log y + t\right)} \]
    12. Simplified79.2%

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

    if 5.20000000000000004e-70 < x < 3.1999999999999999e-15

    1. Initial program 63.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\color{blue}{-1 \cdot \log y} - y \cdot \left(-1 + z\right)\right) - t \]
    7. Step-by-step derivation
      1. mul-1-neg99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 95.1% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;-1 + x \leq -4 \cdot 10^{+30}:\\
\;\;\;\;x \cdot \log y - t\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (-.f64 x 1) < -4.0000000000000001e30

    1. Initial program 95.2%

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

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\left(-1 \cdot \log \left(1 - y\right) + z \cdot \log \left(1 - y\right)\right)}\right) - t \]
    4. Step-by-step derivation
      1. distribute-rgt-out95.2%

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

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \log y} - t \]
    7. Step-by-step derivation
      1. *-commutative93.9%

        \[\leadsto \color{blue}{\log y \cdot x} - t \]
    8. Simplified93.9%

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

    if -4.0000000000000001e30 < (-.f64 x 1) < -1

    1. Initial program 79.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\color{blue}{-1 \cdot \log y} - y \cdot \left(-1 + z\right)\right) - t \]
    7. Step-by-step derivation
      1. mul-1-neg97.2%

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

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

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

    if -1 < (-.f64 x 1)

    1. Initial program 97.8%

      \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
    2. Step-by-step derivation
      1. +-commutative97.8%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(z - 1, \log \left(1 - y\right), \left(x - 1\right) \cdot \log y\right)} - t \]
      3. sub-neg97.8%

        \[\leadsto \mathsf{fma}\left(\color{blue}{z + \left(-1\right)}, \log \left(1 - y\right), \left(x - 1\right) \cdot \log y\right) - t \]
      4. metadata-eval97.8%

        \[\leadsto \mathsf{fma}\left(z + \color{blue}{-1}, \log \left(1 - y\right), \left(x - 1\right) \cdot \log y\right) - t \]
      5. sub-neg97.8%

        \[\leadsto \mathsf{fma}\left(z + -1, \log \color{blue}{\left(1 + \left(-y\right)\right)}, \left(x - 1\right) \cdot \log y\right) - t \]
      6. log1p-def99.7%

        \[\leadsto \mathsf{fma}\left(z + -1, \color{blue}{\mathsf{log1p}\left(-y\right)}, \left(x - 1\right) \cdot \log y\right) - t \]
      7. sub-neg99.7%

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

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

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

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

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

Alternative 7: 76.7% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
t_1 := x \cdot \log y\\
\mathbf{if}\;x \leq -3 \cdot 10^{+49}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq -1.3 \cdot 10^{-25}:\\
\;\;\;\;y \cdot \left(\left(-z\right) - -1\right) - t\\

\mathbf{elif}\;x \leq 7.6 \cdot 10^{+25}:\\
\;\;\;\;y - \left(\log y + t\right)\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -3.0000000000000002e49 or 7.6000000000000001e25 < x

    1. Initial program 96.7%

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

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\left(-1 \cdot \log \left(1 - y\right) + z \cdot \log \left(1 - y\right)\right)}\right) - t \]
    4. Step-by-step derivation
      1. distribute-rgt-out96.7%

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

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

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

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\mathsf{log1p}\left(-1 \cdot y\right)} \cdot \left(-1 + z\right)\right) - t \]
      5. mul-1-neg99.6%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{log1p}\left(\color{blue}{-y}\right) \cdot \left(-1 + z\right)\right) - t \]
    5. Simplified99.6%

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

      \[\leadsto \color{blue}{\left(-1 \cdot \left(y \cdot \left(z - 1\right)\right) + \log y \cdot \left(x - 1\right)\right)} - t \]
    7. Step-by-step derivation
      1. sub-neg99.1%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, 1 - z, \log y \cdot \left(x - 1\right)\right)} - t \]
      10. sub-neg99.1%

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, 1 - z, \log y \cdot \left(-1 + x\right)\right)} - t \]
    9. Taylor expanded in x around inf 82.3%

      \[\leadsto \color{blue}{x \cdot \log y} \]
    10. Step-by-step derivation
      1. *-commutative82.3%

        \[\leadsto \color{blue}{\log y \cdot x} \]
    11. Simplified82.3%

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

    if -3.0000000000000002e49 < x < -1.3e-25

    1. Initial program 72.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\color{blue}{-1 \cdot \log y} - y \cdot \left(-1 + z\right)\right) - t \]
    7. Step-by-step derivation
      1. mul-1-neg85.6%

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

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

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

    if -1.3e-25 < x < 7.6000000000000001e25

    1. Initial program 82.6%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(\left(x + -1\right) \cdot \log y - y \cdot \left(z - 1\right)\right)} - t \]
      7. *-commutative98.2%

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

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

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

        \[\leadsto \left(\log y \cdot \left(-1 + x\right) - y \cdot \left(z + \color{blue}{-1}\right)\right) - t \]
      11. +-commutative98.2%

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

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

      \[\leadsto \left(\color{blue}{-1 \cdot \log y} - y \cdot \left(-1 + z\right)\right) - t \]
    7. Step-by-step derivation
      1. mul-1-neg97.4%

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

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

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

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

        \[\leadsto y + \color{blue}{\left(-\left(t + \log y\right)\right)} \]
      2. +-commutative79.5%

        \[\leadsto y + \left(-\color{blue}{\left(\log y + t\right)}\right) \]
      3. unsub-neg79.5%

        \[\leadsto \color{blue}{y - \left(\log y + t\right)} \]
    12. Simplified79.5%

      \[\leadsto \color{blue}{y - \left(\log y + t\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification80.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -3 \cdot 10^{+49}:\\ \;\;\;\;x \cdot \log y\\ \mathbf{elif}\;x \leq -1.3 \cdot 10^{-25}:\\ \;\;\;\;y \cdot \left(\left(-z\right) - -1\right) - t\\ \mathbf{elif}\;x \leq 7.6 \cdot 10^{+25}:\\ \;\;\;\;y - \left(\log y + t\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \log y\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 76.7% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
t_1 := x \cdot \log y\\
\mathbf{if}\;x \leq -5.6 \cdot 10^{+47}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq -1.3 \cdot 10^{-25}:\\
\;\;\;\;y \cdot \left(\left(-z\right) - -1\right) - t\\

\mathbf{elif}\;x \leq 3.6 \cdot 10^{+25}:\\
\;\;\;\;\left(-t\right) - \log y\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -5.59999999999999976e47 or 3.60000000000000015e25 < x

    1. Initial program 96.7%

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

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\left(-1 \cdot \log \left(1 - y\right) + z \cdot \log \left(1 - y\right)\right)}\right) - t \]
    4. Step-by-step derivation
      1. distribute-rgt-out96.7%

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

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

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

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\mathsf{log1p}\left(-1 \cdot y\right)} \cdot \left(-1 + z\right)\right) - t \]
      5. mul-1-neg99.6%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{log1p}\left(\color{blue}{-y}\right) \cdot \left(-1 + z\right)\right) - t \]
    5. Simplified99.6%

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

      \[\leadsto \color{blue}{\left(-1 \cdot \left(y \cdot \left(z - 1\right)\right) + \log y \cdot \left(x - 1\right)\right)} - t \]
    7. Step-by-step derivation
      1. sub-neg99.1%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, 1 - z, \log y \cdot \left(x - 1\right)\right)} - t \]
      10. sub-neg99.1%

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, 1 - z, \log y \cdot \left(-1 + x\right)\right)} - t \]
    9. Taylor expanded in x around inf 82.3%

      \[\leadsto \color{blue}{x \cdot \log y} \]
    10. Step-by-step derivation
      1. *-commutative82.3%

        \[\leadsto \color{blue}{\log y \cdot x} \]
    11. Simplified82.3%

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

    if -5.59999999999999976e47 < x < -1.3e-25

    1. Initial program 72.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\color{blue}{-1 \cdot \log y} - y \cdot \left(-1 + z\right)\right) - t \]
    7. Step-by-step derivation
      1. mul-1-neg85.6%

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

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

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

    if -1.3e-25 < x < 3.60000000000000015e25

    1. Initial program 82.6%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(\left(x + -1\right) \cdot \log y - y \cdot \left(z - 1\right)\right)} - t \]
      7. *-commutative98.2%

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

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

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

        \[\leadsto \left(\log y \cdot \left(-1 + x\right) - y \cdot \left(z + \color{blue}{-1}\right)\right) - t \]
      11. +-commutative98.2%

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

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

      \[\leadsto \left(\color{blue}{-1 \cdot \log y} - y \cdot \left(-1 + z\right)\right) - t \]
    7. Step-by-step derivation
      1. mul-1-neg97.4%

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

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

      \[\leadsto \color{blue}{-1 \cdot \log y} - t \]
    10. Step-by-step derivation
      1. mul-1-neg79.2%

        \[\leadsto \color{blue}{\left(-\log y\right)} - t \]
    11. Simplified79.2%

      \[\leadsto \color{blue}{\left(-\log y\right)} - t \]
  3. Recombined 3 regimes into one program.
  4. Final simplification80.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -5.6 \cdot 10^{+47}:\\ \;\;\;\;x \cdot \log y\\ \mathbf{elif}\;x \leq -1.3 \cdot 10^{-25}:\\ \;\;\;\;y \cdot \left(\left(-z\right) - -1\right) - t\\ \mathbf{elif}\;x \leq 3.6 \cdot 10^{+25}:\\ \;\;\;\;\left(-t\right) - \log y\\ \mathbf{else}:\\ \;\;\;\;x \cdot \log y\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 95.5% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \log y \cdot \left(-1 + x\right)\\ \mathbf{if}\;t \leq -6600000 \lor \neg \left(t \leq 1.05 \cdot 10^{-33}\right):\\ \;\;\;\;t_1 - t\\ \mathbf{else}:\\ \;\;\;\;t_1 - z \cdot y\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* (log y) (+ -1.0 x))))
   (if (or (<= t -6600000.0) (not (<= t 1.05e-33)))
     (- t_1 t)
     (- t_1 (* z y)))))
double code(double x, double y, double z, double t) {
	double t_1 = log(y) * (-1.0 + x);
	double tmp;
	if ((t <= -6600000.0) || !(t <= 1.05e-33)) {
		tmp = t_1 - t;
	} else {
		tmp = t_1 - (z * y);
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = log(y) * ((-1.0d0) + x)
    if ((t <= (-6600000.0d0)) .or. (.not. (t <= 1.05d-33))) then
        tmp = t_1 - t
    else
        tmp = t_1 - (z * y)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = Math.log(y) * (-1.0 + x);
	double tmp;
	if ((t <= -6600000.0) || !(t <= 1.05e-33)) {
		tmp = t_1 - t;
	} else {
		tmp = t_1 - (z * y);
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = math.log(y) * (-1.0 + x)
	tmp = 0
	if (t <= -6600000.0) or not (t <= 1.05e-33):
		tmp = t_1 - t
	else:
		tmp = t_1 - (z * y)
	return tmp
function code(x, y, z, t)
	t_1 = Float64(log(y) * Float64(-1.0 + x))
	tmp = 0.0
	if ((t <= -6600000.0) || !(t <= 1.05e-33))
		tmp = Float64(t_1 - t);
	else
		tmp = Float64(t_1 - Float64(z * y));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = log(y) * (-1.0 + x);
	tmp = 0.0;
	if ((t <= -6600000.0) || ~((t <= 1.05e-33)))
		tmp = t_1 - t;
	else
		tmp = t_1 - (z * y);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t, -6600000.0], N[Not[LessEqual[t, 1.05e-33]], $MachinePrecision]], N[(t$95$1 - t), $MachinePrecision], N[(t$95$1 - N[(z * y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \log y \cdot \left(-1 + x\right)\\
\mathbf{if}\;t \leq -6600000 \lor \neg \left(t \leq 1.05 \cdot 10^{-33}\right):\\
\;\;\;\;t_1 - t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -6.6e6 or 1.05e-33 < t

    1. Initial program 96.4%

      \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
    2. Step-by-step derivation
      1. +-commutative96.4%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(z - 1, \log \left(1 - y\right), \left(x - 1\right) \cdot \log y\right)} - t \]
      3. sub-neg96.4%

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

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

        \[\leadsto \mathsf{fma}\left(z + -1, \log \color{blue}{\left(1 + \left(-y\right)\right)}, \left(x - 1\right) \cdot \log y\right) - t \]
      6. log1p-def99.8%

        \[\leadsto \mathsf{fma}\left(z + -1, \color{blue}{\mathsf{log1p}\left(-y\right)}, \left(x - 1\right) \cdot \log y\right) - t \]
      7. sub-neg99.8%

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

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

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

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

    if -6.6e6 < t < 1.05e-33

    1. Initial program 81.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 87.5% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \lor \neg \left(x \leq 4.8 \cdot 10^{-14}\right):\\
\;\;\;\;x \cdot \log y - t\\

\mathbf{else}:\\
\;\;\;\;y - \left(\log y + t\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1 or 4.8e-14 < x

    1. Initial program 94.8%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \log y} - t \]
    7. Step-by-step derivation
      1. *-commutative94.0%

        \[\leadsto \color{blue}{\log y \cdot x} - t \]
    8. Simplified94.0%

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

    if -1 < x < 4.8e-14

    1. Initial program 80.3%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(\left(x + -1\right) \cdot \log y - y \cdot \left(z - 1\right)\right)} - t \]
      7. *-commutative98.2%

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

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

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

        \[\leadsto \left(\log y \cdot \left(-1 + x\right) - y \cdot \left(z + \color{blue}{-1}\right)\right) - t \]
      11. +-commutative98.2%

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

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

      \[\leadsto \left(\color{blue}{-1 \cdot \log y} - y \cdot \left(-1 + z\right)\right) - t \]
    7. Step-by-step derivation
      1. mul-1-neg97.9%

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

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

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

      \[\leadsto \color{blue}{y + -1 \cdot \left(t + \log y\right)} \]
    11. Step-by-step derivation
      1. mul-1-neg77.7%

        \[\leadsto y + \color{blue}{\left(-\left(t + \log y\right)\right)} \]
      2. +-commutative77.7%

        \[\leadsto y + \left(-\color{blue}{\left(\log y + t\right)}\right) \]
      3. unsub-neg77.7%

        \[\leadsto \color{blue}{y - \left(\log y + t\right)} \]
    12. Simplified77.7%

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

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

Alternative 11: 88.6% accurate, 1.9× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 z 1) < -2.0000000000000001e300

    1. Initial program 4.5%

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

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\left(-1 \cdot \log \left(1 - y\right) + z \cdot \log \left(1 - y\right)\right)}\right) - t \]
    4. Step-by-step derivation
      1. distribute-rgt-out4.5%

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

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

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \log \left(1 + \color{blue}{-1 \cdot y}\right) \cdot \left(-1 + z\right)\right) - t \]
      4. log1p-def100.0%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\mathsf{log1p}\left(-1 \cdot y\right)} \cdot \left(-1 + z\right)\right) - t \]
      5. mul-1-neg100.0%

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

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

      \[\leadsto \color{blue}{\left(-1 \cdot \left(y \cdot \left(z - 1\right)\right) + \log y \cdot \left(x - 1\right)\right)} - t \]
    7. Step-by-step derivation
      1. sub-neg100.0%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, 1 - z, \log y \cdot \left(x - 1\right)\right)} - t \]
      10. sub-neg100.0%

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, 1 - z, \log y \cdot \left(-1 + x\right)\right)} - t \]
    9. Taylor expanded in z around inf 100.0%

      \[\leadsto \color{blue}{-1 \cdot \left(y \cdot z\right)} \]
    10. Step-by-step derivation
      1. associate-*r*100.0%

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

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

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

    if -2.0000000000000001e300 < (-.f64 z 1)

    1. Initial program 89.7%

      \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
    2. Step-by-step derivation
      1. +-commutative89.7%

        \[\leadsto \color{blue}{\left(\left(z - 1\right) \cdot \log \left(1 - y\right) + \left(x - 1\right) \cdot \log y\right)} - t \]
      2. fma-def89.7%

        \[\leadsto \color{blue}{\mathsf{fma}\left(z - 1, \log \left(1 - y\right), \left(x - 1\right) \cdot \log y\right)} - t \]
      3. sub-neg89.7%

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

        \[\leadsto \mathsf{fma}\left(z + \color{blue}{-1}, \log \left(1 - y\right), \left(x - 1\right) \cdot \log y\right) - t \]
      5. sub-neg89.7%

        \[\leadsto \mathsf{fma}\left(z + -1, \log \color{blue}{\left(1 + \left(-y\right)\right)}, \left(x - 1\right) \cdot \log y\right) - t \]
      6. log1p-def99.8%

        \[\leadsto \mathsf{fma}\left(z + -1, \color{blue}{\mathsf{log1p}\left(-y\right)}, \left(x - 1\right) \cdot \log y\right) - t \]
      7. sub-neg99.8%

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

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

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

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

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

Alternative 12: 66.3% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.32 \cdot 10^{+47} \lor \neg \left(x \leq 1.25 \cdot 10^{+23}\right):\\
\;\;\;\;x \cdot \log y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.31999999999999992e47 or 1.25e23 < x

    1. Initial program 96.7%

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

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\left(-1 \cdot \log \left(1 - y\right) + z \cdot \log \left(1 - y\right)\right)}\right) - t \]
    4. Step-by-step derivation
      1. distribute-rgt-out96.7%

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

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

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

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\mathsf{log1p}\left(-1 \cdot y\right)} \cdot \left(-1 + z\right)\right) - t \]
      5. mul-1-neg99.6%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{log1p}\left(\color{blue}{-y}\right) \cdot \left(-1 + z\right)\right) - t \]
    5. Simplified99.6%

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

      \[\leadsto \color{blue}{\left(-1 \cdot \left(y \cdot \left(z - 1\right)\right) + \log y \cdot \left(x - 1\right)\right)} - t \]
    7. Step-by-step derivation
      1. sub-neg99.1%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, 1 - z, \log y \cdot \left(x - 1\right)\right)} - t \]
      10. sub-neg99.1%

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, 1 - z, \log y \cdot \left(-1 + x\right)\right)} - t \]
    9. Taylor expanded in x around inf 82.3%

      \[\leadsto \color{blue}{x \cdot \log y} \]
    10. Step-by-step derivation
      1. *-commutative82.3%

        \[\leadsto \color{blue}{\log y \cdot x} \]
    11. Simplified82.3%

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

    if -1.31999999999999992e47 < x < 1.25e23

    1. Initial program 81.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\color{blue}{-1 \cdot \log y} - y \cdot \left(-1 + z\right)\right) - t \]
    7. Step-by-step derivation
      1. mul-1-neg95.4%

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

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

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

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

Alternative 13: 99.1% accurate, 1.9× speedup?

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(\left(x + -1\right) \cdot \log y - y \cdot \left(z - 1\right)\right)} - t \]
    7. *-commutative98.8%

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

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

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

      \[\leadsto \left(\log y \cdot \left(-1 + x\right) - y \cdot \left(z + \color{blue}{-1}\right)\right) - t \]
    11. +-commutative98.8%

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

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

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

Alternative 14: 99.1% accurate, 1.9× speedup?

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(\left(x + -1\right) \cdot \log y - y \cdot \left(z - 1\right)\right)} - t \]
    7. *-commutative98.8%

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

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

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

      \[\leadsto \left(\log y \cdot \left(-1 + x\right) - y \cdot \left(z + \color{blue}{-1}\right)\right) - t \]
    11. +-commutative98.8%

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

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

    \[\leadsto \color{blue}{\left(-1 \cdot t + \log y \cdot \left(x - 1\right)\right) - y \cdot \left(z - 1\right)} \]
  7. Final simplification98.8%

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

Alternative 15: 99.0% accurate, 1.9× speedup?

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(\left(x + -1\right) \cdot \log y - y \cdot \left(z - 1\right)\right)} - t \]
    7. *-commutative98.8%

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

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

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

      \[\leadsto \left(\log y \cdot \left(-1 + x\right) - y \cdot \left(z + \color{blue}{-1}\right)\right) - t \]
    11. +-commutative98.8%

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

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

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

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

Alternative 16: 43.2% accurate, 14.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -2900000 \lor \neg \left(t \leq 145000\right):\\ \;\;\;\;-t\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(1 - z\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (or (<= t -2900000.0) (not (<= t 145000.0))) (- t) (* y (- 1.0 z))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((t <= -2900000.0) || !(t <= 145000.0)) {
		tmp = -t;
	} else {
		tmp = y * (1.0 - z);
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if ((t <= (-2900000.0d0)) .or. (.not. (t <= 145000.0d0))) then
        tmp = -t
    else
        tmp = y * (1.0d0 - z)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if ((t <= -2900000.0) || !(t <= 145000.0)) {
		tmp = -t;
	} else {
		tmp = y * (1.0 - z);
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (t <= -2900000.0) or not (t <= 145000.0):
		tmp = -t
	else:
		tmp = y * (1.0 - z)
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((t <= -2900000.0) || !(t <= 145000.0))
		tmp = Float64(-t);
	else
		tmp = Float64(y * Float64(1.0 - z));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((t <= -2900000.0) || ~((t <= 145000.0)))
		tmp = -t;
	else
		tmp = y * (1.0 - z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -2900000.0], N[Not[LessEqual[t, 145000.0]], $MachinePrecision]], (-t), N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;t \leq -2900000 \lor \neg \left(t \leq 145000\right):\\
\;\;\;\;-t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -2.9e6 or 145000 < t

    1. Initial program 96.0%

      \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
    2. Step-by-step derivation
      1. +-commutative96.0%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(z - 1, \log \left(1 - y\right), \left(x - 1\right) \cdot \log y\right)} - t \]
      3. sub-neg96.0%

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

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

        \[\leadsto \mathsf{fma}\left(z + -1, \log \color{blue}{\left(1 + \left(-y\right)\right)}, \left(x - 1\right) \cdot \log y\right) - t \]
      6. log1p-def99.8%

        \[\leadsto \mathsf{fma}\left(z + -1, \color{blue}{\mathsf{log1p}\left(-y\right)}, \left(x - 1\right) \cdot \log y\right) - t \]
      7. sub-neg99.8%

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

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

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

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

        \[\leadsto \color{blue}{-t} \]
    7. Simplified75.1%

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

    if -2.9e6 < t < 145000

    1. Initial program 82.9%

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

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\left(-1 \cdot \log \left(1 - y\right) + z \cdot \log \left(1 - y\right)\right)}\right) - t \]
    4. Step-by-step derivation
      1. distribute-rgt-out82.9%

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

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

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \log \left(1 + \color{blue}{-1 \cdot y}\right) \cdot \left(-1 + z\right)\right) - t \]
      4. log1p-def99.8%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\mathsf{log1p}\left(-1 \cdot y\right)} \cdot \left(-1 + z\right)\right) - t \]
      5. mul-1-neg99.8%

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

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

      \[\leadsto \color{blue}{\left(-1 \cdot \left(y \cdot \left(z - 1\right)\right) + \log y \cdot \left(x - 1\right)\right)} - t \]
    7. Step-by-step derivation
      1. sub-neg98.1%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, 1 - z, \log y \cdot \left(x - 1\right)\right)} - t \]
      10. sub-neg98.1%

        \[\leadsto \mathsf{fma}\left(y, 1 - z, \log y \cdot \color{blue}{\left(x + \left(-1\right)\right)}\right) - t \]
      11. metadata-eval98.1%

        \[\leadsto \mathsf{fma}\left(y, 1 - z, \log y \cdot \left(x + \color{blue}{-1}\right)\right) - t \]
      12. +-commutative98.1%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, 1 - z, \log y \cdot \left(-1 + x\right)\right)} - t \]
    9. Taylor expanded in y around inf 19.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -2900000 \lor \neg \left(t \leq 145000\right):\\ \;\;\;\;-t\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(1 - z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 17: 42.9% accurate, 15.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -9200000 \lor \neg \left(t \leq 3350000\right):\\ \;\;\;\;-t\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(-z\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (or (<= t -9200000.0) (not (<= t 3350000.0))) (- t) (* y (- z))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((t <= -9200000.0) || !(t <= 3350000.0)) {
		tmp = -t;
	} else {
		tmp = y * -z;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if ((t <= (-9200000.0d0)) .or. (.not. (t <= 3350000.0d0))) then
        tmp = -t
    else
        tmp = y * -z
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if ((t <= -9200000.0) || !(t <= 3350000.0)) {
		tmp = -t;
	} else {
		tmp = y * -z;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (t <= -9200000.0) or not (t <= 3350000.0):
		tmp = -t
	else:
		tmp = y * -z
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((t <= -9200000.0) || !(t <= 3350000.0))
		tmp = Float64(-t);
	else
		tmp = Float64(y * Float64(-z));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((t <= -9200000.0) || ~((t <= 3350000.0)))
		tmp = -t;
	else
		tmp = y * -z;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -9200000.0], N[Not[LessEqual[t, 3350000.0]], $MachinePrecision]], (-t), N[(y * (-z)), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;t \leq -9200000 \lor \neg \left(t \leq 3350000\right):\\
\;\;\;\;-t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -9.2e6 or 3.35e6 < t

    1. Initial program 96.0%

      \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
    2. Step-by-step derivation
      1. +-commutative96.0%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(z - 1, \log \left(1 - y\right), \left(x - 1\right) \cdot \log y\right)} - t \]
      3. sub-neg96.0%

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

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

        \[\leadsto \mathsf{fma}\left(z + -1, \log \color{blue}{\left(1 + \left(-y\right)\right)}, \left(x - 1\right) \cdot \log y\right) - t \]
      6. log1p-def99.8%

        \[\leadsto \mathsf{fma}\left(z + -1, \color{blue}{\mathsf{log1p}\left(-y\right)}, \left(x - 1\right) \cdot \log y\right) - t \]
      7. sub-neg99.8%

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

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

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

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

        \[\leadsto \color{blue}{-t} \]
    7. Simplified75.1%

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

    if -9.2e6 < t < 3.35e6

    1. Initial program 82.9%

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

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\left(-1 \cdot \log \left(1 - y\right) + z \cdot \log \left(1 - y\right)\right)}\right) - t \]
    4. Step-by-step derivation
      1. distribute-rgt-out82.9%

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

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

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \log \left(1 + \color{blue}{-1 \cdot y}\right) \cdot \left(-1 + z\right)\right) - t \]
      4. log1p-def99.8%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\mathsf{log1p}\left(-1 \cdot y\right)} \cdot \left(-1 + z\right)\right) - t \]
      5. mul-1-neg99.8%

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

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

      \[\leadsto \color{blue}{\left(-1 \cdot \left(y \cdot \left(z - 1\right)\right) + \log y \cdot \left(x - 1\right)\right)} - t \]
    7. Step-by-step derivation
      1. sub-neg98.1%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, 1 - z, \log y \cdot \left(x - 1\right)\right)} - t \]
      10. sub-neg98.1%

        \[\leadsto \mathsf{fma}\left(y, 1 - z, \log y \cdot \color{blue}{\left(x + \left(-1\right)\right)}\right) - t \]
      11. metadata-eval98.1%

        \[\leadsto \mathsf{fma}\left(y, 1 - z, \log y \cdot \left(x + \color{blue}{-1}\right)\right) - t \]
      12. +-commutative98.1%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, 1 - z, \log y \cdot \left(-1 + x\right)\right)} - t \]
    9. Taylor expanded in z around inf 18.8%

      \[\leadsto \color{blue}{-1 \cdot \left(y \cdot z\right)} \]
    10. Step-by-step derivation
      1. associate-*r*18.8%

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

        \[\leadsto \color{blue}{\left(-y\right)} \cdot z \]
    11. Simplified18.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -9200000 \lor \neg \left(t \leq 3350000\right):\\ \;\;\;\;-t\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(-z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 18: 46.0% accurate, 26.9× speedup?

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

\\
y \cdot \left(\left(-z\right) - -1\right) - t
\end{array}
Derivation
  1. Initial program 88.1%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(\left(x + -1\right) \cdot \log y - y \cdot \left(z - 1\right)\right)} - t \]
    7. *-commutative98.8%

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

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

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

      \[\leadsto \left(\log y \cdot \left(-1 + x\right) - y \cdot \left(z + \color{blue}{-1}\right)\right) - t \]
    11. +-commutative98.8%

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

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

    \[\leadsto \left(\color{blue}{-1 \cdot \log y} - y \cdot \left(-1 + z\right)\right) - t \]
  7. Step-by-step derivation
    1. mul-1-neg60.9%

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

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

    \[\leadsto \color{blue}{-1 \cdot \left(y \cdot \left(z - 1\right)\right)} - t \]
  10. Final simplification42.8%

    \[\leadsto y \cdot \left(\left(-z\right) - -1\right) - t \]
  11. Add Preprocessing

Alternative 19: 45.8% accurate, 35.8× speedup?

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

\\
y \cdot \left(-z\right) - t
\end{array}
Derivation
  1. Initial program 88.1%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(\left(x + -1\right) \cdot \log y - y \cdot \left(z - 1\right)\right)} - t \]
    7. *-commutative98.8%

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

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

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

      \[\leadsto \left(\log y \cdot \left(-1 + x\right) - y \cdot \left(z + \color{blue}{-1}\right)\right) - t \]
    11. +-commutative98.8%

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

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

    \[\leadsto \color{blue}{-1 \cdot \left(y \cdot z\right)} - t \]
  7. Step-by-step derivation
    1. associate-*r*42.6%

      \[\leadsto \color{blue}{\left(-1 \cdot y\right) \cdot z} - t \]
    2. mul-1-neg42.6%

      \[\leadsto \color{blue}{\left(-y\right)} \cdot z - t \]
  8. Simplified42.6%

    \[\leadsto \color{blue}{\left(-y\right) \cdot z} - t \]
  9. Final simplification42.6%

    \[\leadsto y \cdot \left(-z\right) - t \]
  10. Add Preprocessing

Alternative 20: 35.9% accurate, 107.5× speedup?

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

\\
-t
\end{array}
Derivation
  1. Initial program 88.1%

    \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
  2. Step-by-step derivation
    1. +-commutative88.1%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(z - 1, \log \left(1 - y\right), \left(x - 1\right) \cdot \log y\right)} - t \]
    3. sub-neg88.1%

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

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

      \[\leadsto \mathsf{fma}\left(z + -1, \log \color{blue}{\left(1 + \left(-y\right)\right)}, \left(x - 1\right) \cdot \log y\right) - t \]
    6. log1p-def99.8%

      \[\leadsto \mathsf{fma}\left(z + -1, \color{blue}{\mathsf{log1p}\left(-y\right)}, \left(x - 1\right) \cdot \log y\right) - t \]
    7. sub-neg99.8%

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

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

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

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

      \[\leadsto \color{blue}{-t} \]
  7. Simplified31.3%

    \[\leadsto \color{blue}{-t} \]
  8. Final simplification31.3%

    \[\leadsto -t \]
  9. Add Preprocessing

Reproduce

?
herbie shell --seed 2024018 
(FPCore (x y z t)
  :name "Statistics.Distribution.Beta:$cdensity from math-functions-0.1.5.2"
  :precision binary64
  (- (+ (* (- x 1.0) (log y)) (* (- z 1.0) (log (- 1.0 y)))) t))