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

Percentage Accurate: 89.6% → 99.8%
Time: 15.4s
Alternatives: 16
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 16 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.6% 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), \left(x + -1\right) \cdot \log y - t\right) \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (fma (- z 1.0) (log1p (- y)) (- (* (+ x -1.0) (log y)) t)))
double code(double x, double y, double z, double t) {
	return fma((z - 1.0), log1p(-y), (((x + -1.0) * log(y)) - t));
}
function code(x, y, z, t)
	return fma(Float64(z - 1.0), log1p(Float64(-y)), Float64(Float64(Float64(x + -1.0) * log(y)) - t))
end
code[x_, y_, z_, t_] := N[(N[(z - 1.0), $MachinePrecision] * N[Log[1 + (-y)], $MachinePrecision] + N[(N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

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

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

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

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

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

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

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

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

Alternative 2: 99.7% accurate, 1.0× speedup?

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

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

    \[\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. associate--l+88.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \color{blue}{\mathsf{fma}\left(\log y, -\left(x - 1\right), t\right)} \]
    15. neg-sub099.9%

      \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \mathsf{fma}\left(\log y, \color{blue}{0 - \left(x - 1\right)}, t\right) \]
    16. associate--r-99.9%

      \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \mathsf{fma}\left(\log y, \color{blue}{\left(0 - x\right) + 1}, t\right) \]
    17. neg-sub099.9%

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

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

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

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

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

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

Alternative 3: 88.6% accurate, 1.8× speedup?

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

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

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


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

    1. Initial program 88.5%

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

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

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

    1. Initial program 88.5%

      \[\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. associate--l+88.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \color{blue}{\mathsf{fma}\left(\log y, -\left(x - 1\right), t\right)} \]
      15. neg-sub099.9%

        \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \mathsf{fma}\left(\log y, \color{blue}{0 - \left(x - 1\right)}, t\right) \]
      16. associate--r-99.9%

        \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \mathsf{fma}\left(\log y, \color{blue}{\left(0 - x\right) + 1}, t\right) \]
      17. neg-sub099.9%

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

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

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

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

      \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \color{blue}{\left(t + \log y\right)} \]
    5. Step-by-step derivation
      1. +-commutative68.8%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x + -1 \leq -1 \lor \neg \left(x + -1 \leq -1\right):\\ \;\;\;\;\left(x + -1\right) \cdot \log y - t\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(1 - z\right) - \left(\log y + t\right)\\ \end{array} \]

Alternative 4: 88.6% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x + -1 \leq -1\\ \mathbf{if}\;t_1:\\ \;\;\;\;\log \left(\frac{1}{y}\right) \cdot \left(1 - x\right) - t\\ \mathbf{elif}\;t_1:\\ \;\;\;\;y \cdot \left(1 - z\right) - \left(\log y + t\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x + -1\right) \cdot \log y - t\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (<= (+ x -1.0) -1.0)))
   (if t_1
     (- (* (log (/ 1.0 y)) (- 1.0 x)) t)
     (if t_1 (- (* y (- 1.0 z)) (+ (log y) t)) (- (* (+ x -1.0) (log y)) t)))))
double code(double x, double y, double z, double t) {
	int t_1 = (x + -1.0) <= -1.0;
	double tmp;
	if (t_1) {
		tmp = (log((1.0 / y)) * (1.0 - x)) - t;
	} else if (t_1) {
		tmp = (y * (1.0 - z)) - (log(y) + t);
	} else {
		tmp = ((x + -1.0) * 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
    logical :: t_1
    real(8) :: tmp
    t_1 = (x + (-1.0d0)) <= (-1.0d0)
    if (t_1) then
        tmp = (log((1.0d0 / y)) * (1.0d0 - x)) - t
    else if (t_1) then
        tmp = (y * (1.0d0 - z)) - (log(y) + t)
    else
        tmp = ((x + (-1.0d0)) * log(y)) - t
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	boolean t_1 = (x + -1.0) <= -1.0;
	double tmp;
	if (t_1) {
		tmp = (Math.log((1.0 / y)) * (1.0 - x)) - t;
	} else if (t_1) {
		tmp = (y * (1.0 - z)) - (Math.log(y) + t);
	} else {
		tmp = ((x + -1.0) * Math.log(y)) - t;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (x + -1.0) <= -1.0
	tmp = 0
	if t_1:
		tmp = (math.log((1.0 / y)) * (1.0 - x)) - t
	elif t_1:
		tmp = (y * (1.0 - z)) - (math.log(y) + t)
	else:
		tmp = ((x + -1.0) * math.log(y)) - t
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x + -1.0) <= -1.0
	tmp = 0.0
	if (t_1)
		tmp = Float64(Float64(log(Float64(1.0 / y)) * Float64(1.0 - x)) - t);
	elseif (t_1)
		tmp = Float64(Float64(y * Float64(1.0 - z)) - Float64(log(y) + t));
	else
		tmp = Float64(Float64(Float64(x + -1.0) * log(y)) - t);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = (x + -1.0) <= -1.0;
	tmp = 0.0;
	if (t_1)
		tmp = (log((1.0 / y)) * (1.0 - x)) - t;
	elseif (t_1)
		tmp = (y * (1.0 - z)) - (log(y) + t);
	else
		tmp = ((x + -1.0) * log(y)) - t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = LessEqual[N[(x + -1.0), $MachinePrecision], -1.0]}, If[t$95$1, N[(N[(N[Log[N[(1.0 / y), $MachinePrecision]], $MachinePrecision] * N[(1.0 - x), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[t$95$1, N[(N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision] - N[(N[Log[y], $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]]]
\begin{array}{l}

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

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

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


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

    1. Initial program 87.0%

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

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

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

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

    1. Initial program 88.5%

      \[\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. associate--l+88.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \color{blue}{\mathsf{fma}\left(\log y, -\left(x - 1\right), t\right)} \]
      15. neg-sub099.9%

        \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \mathsf{fma}\left(\log y, \color{blue}{0 - \left(x - 1\right)}, t\right) \]
      16. associate--r-99.9%

        \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \mathsf{fma}\left(\log y, \color{blue}{\left(0 - x\right) + 1}, t\right) \]
      17. neg-sub099.9%

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

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

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

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

      \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \color{blue}{\left(t + \log y\right)} \]
    5. Step-by-step derivation
      1. +-commutative68.8%

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

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

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

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

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

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

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

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

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

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

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

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

    if -1 < (-.f64 x 1)

    1. Initial program 92.7%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x + -1 \leq -1:\\ \;\;\;\;\log \left(\frac{1}{y}\right) \cdot \left(1 - x\right) - t\\ \mathbf{elif}\;x + -1 \leq -1:\\ \;\;\;\;y \cdot \left(1 - z\right) - \left(\log y + t\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x + -1\right) \cdot \log y - t\\ \end{array} \]

Alternative 5: 57.3% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := y - \log y\\ t_2 := x \cdot \log y\\ \mathbf{if}\;t \leq -56000000000:\\ \;\;\;\;-t\\ \mathbf{elif}\;t \leq -7.5 \cdot 10^{-219}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq -1.62 \cdot 10^{-281}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 4.8 \cdot 10^{-55}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq 1.26 \cdot 10^{-34}:\\ \;\;\;\;y \cdot \left(1 - z\right)\\ \mathbf{elif}\;t \leq 400:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;-t\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (- y (log y))) (t_2 (* x (log y))))
   (if (<= t -56000000000.0)
     (- t)
     (if (<= t -7.5e-219)
       t_2
       (if (<= t -1.62e-281)
         t_1
         (if (<= t 4.8e-55)
           t_2
           (if (<= t 1.26e-34)
             (* y (- 1.0 z))
             (if (<= t 400.0) t_1 (- t)))))))))
double code(double x, double y, double z, double t) {
	double t_1 = y - log(y);
	double t_2 = x * log(y);
	double tmp;
	if (t <= -56000000000.0) {
		tmp = -t;
	} else if (t <= -7.5e-219) {
		tmp = t_2;
	} else if (t <= -1.62e-281) {
		tmp = t_1;
	} else if (t <= 4.8e-55) {
		tmp = t_2;
	} else if (t <= 1.26e-34) {
		tmp = y * (1.0 - z);
	} else if (t <= 400.0) {
		tmp = t_1;
	} else {
		tmp = -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) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = y - log(y)
    t_2 = x * log(y)
    if (t <= (-56000000000.0d0)) then
        tmp = -t
    else if (t <= (-7.5d-219)) then
        tmp = t_2
    else if (t <= (-1.62d-281)) then
        tmp = t_1
    else if (t <= 4.8d-55) then
        tmp = t_2
    else if (t <= 1.26d-34) then
        tmp = y * (1.0d0 - z)
    else if (t <= 400.0d0) then
        tmp = t_1
    else
        tmp = -t
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = y - Math.log(y);
	double t_2 = x * Math.log(y);
	double tmp;
	if (t <= -56000000000.0) {
		tmp = -t;
	} else if (t <= -7.5e-219) {
		tmp = t_2;
	} else if (t <= -1.62e-281) {
		tmp = t_1;
	} else if (t <= 4.8e-55) {
		tmp = t_2;
	} else if (t <= 1.26e-34) {
		tmp = y * (1.0 - z);
	} else if (t <= 400.0) {
		tmp = t_1;
	} else {
		tmp = -t;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = y - math.log(y)
	t_2 = x * math.log(y)
	tmp = 0
	if t <= -56000000000.0:
		tmp = -t
	elif t <= -7.5e-219:
		tmp = t_2
	elif t <= -1.62e-281:
		tmp = t_1
	elif t <= 4.8e-55:
		tmp = t_2
	elif t <= 1.26e-34:
		tmp = y * (1.0 - z)
	elif t <= 400.0:
		tmp = t_1
	else:
		tmp = -t
	return tmp
function code(x, y, z, t)
	t_1 = Float64(y - log(y))
	t_2 = Float64(x * log(y))
	tmp = 0.0
	if (t <= -56000000000.0)
		tmp = Float64(-t);
	elseif (t <= -7.5e-219)
		tmp = t_2;
	elseif (t <= -1.62e-281)
		tmp = t_1;
	elseif (t <= 4.8e-55)
		tmp = t_2;
	elseif (t <= 1.26e-34)
		tmp = Float64(y * Float64(1.0 - z));
	elseif (t <= 400.0)
		tmp = t_1;
	else
		tmp = Float64(-t);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = y - log(y);
	t_2 = x * log(y);
	tmp = 0.0;
	if (t <= -56000000000.0)
		tmp = -t;
	elseif (t <= -7.5e-219)
		tmp = t_2;
	elseif (t <= -1.62e-281)
		tmp = t_1;
	elseif (t <= 4.8e-55)
		tmp = t_2;
	elseif (t <= 1.26e-34)
		tmp = y * (1.0 - z);
	elseif (t <= 400.0)
		tmp = t_1;
	else
		tmp = -t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y - N[Log[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -56000000000.0], (-t), If[LessEqual[t, -7.5e-219], t$95$2, If[LessEqual[t, -1.62e-281], t$95$1, If[LessEqual[t, 4.8e-55], t$95$2, If[LessEqual[t, 1.26e-34], N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 400.0], t$95$1, (-t)]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;t \leq -7.5 \cdot 10^{-219}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;t \leq -1.62 \cdot 10^{-281}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;t \leq 4.8 \cdot 10^{-55}:\\
\;\;\;\;t_2\\

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

\mathbf{elif}\;t \leq 400:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if t < -5.6e10 or 400 < t

    1. Initial program 95.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. associate--l+95.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \color{blue}{\mathsf{fma}\left(\log y, -\left(x - 1\right), t\right)} \]
      15. neg-sub099.9%

        \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \mathsf{fma}\left(\log y, \color{blue}{0 - \left(x - 1\right)}, t\right) \]
      16. associate--r-99.9%

        \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \mathsf{fma}\left(\log y, \color{blue}{\left(0 - x\right) + 1}, t\right) \]
      17. neg-sub099.9%

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

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

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

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

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

        \[\leadsto \color{blue}{-t} \]
    6. Simplified74.8%

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

    if -5.6e10 < t < -7.4999999999999996e-219 or -1.6200000000000001e-281 < t < 4.79999999999999983e-55

    1. Initial program 85.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. associate--l+85.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \mathsf{fma}\left(\log y, \color{blue}{0 - \left(x - 1\right)}, t\right) \]
      16. associate--r-99.8%

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

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

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

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

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

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

    if -7.4999999999999996e-219 < t < -1.6200000000000001e-281 or 1.26000000000000009e-34 < t < 400

    1. Initial program 90.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. associate--l+90.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \color{blue}{\mathsf{fma}\left(\log y, -\left(x - 1\right), t\right)} \]
      15. neg-sub099.9%

        \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \mathsf{fma}\left(\log y, \color{blue}{0 - \left(x - 1\right)}, t\right) \]
      16. associate--r-99.9%

        \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \mathsf{fma}\left(\log y, \color{blue}{\left(0 - x\right) + 1}, t\right) \]
      17. neg-sub099.9%

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

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

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

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

      \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \color{blue}{\left(t + \log y\right)} \]
    5. Step-by-step derivation
      1. +-commutative82.3%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{y} - \left(\log y + t\right) \]
    11. Taylor expanded in t around 0 62.2%

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

    if 4.79999999999999983e-55 < t < 1.26000000000000009e-34

    1. Initial program 35.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. associate--l+35.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \mathsf{fma}\left(\log y, \color{blue}{0 - \left(x - 1\right)}, t\right) \]
      16. associate--r-100.0%

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

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

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

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

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

      \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \color{blue}{\left(t + \log y\right)} \]
    5. Step-by-step derivation
      1. +-commutative89.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -56000000000:\\ \;\;\;\;-t\\ \mathbf{elif}\;t \leq -7.5 \cdot 10^{-219}:\\ \;\;\;\;x \cdot \log y\\ \mathbf{elif}\;t \leq -1.62 \cdot 10^{-281}:\\ \;\;\;\;y - \log y\\ \mathbf{elif}\;t \leq 4.8 \cdot 10^{-55}:\\ \;\;\;\;x \cdot \log y\\ \mathbf{elif}\;t \leq 1.26 \cdot 10^{-34}:\\ \;\;\;\;y \cdot \left(1 - z\right)\\ \mathbf{elif}\;t \leq 400:\\ \;\;\;\;y - \log y\\ \mathbf{else}:\\ \;\;\;\;-t\\ \end{array} \]

Alternative 6: 76.0% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(-\log y\right) - t\\ t_2 := \left(x + -1\right) \cdot \log y\\ \mathbf{if}\;t \leq -48000000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 4.5 \cdot 10^{-55}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq 2 \cdot 10^{-34}:\\ \;\;\;\;y \cdot \left(1 - z\right) - \log y\\ \mathbf{elif}\;t \leq 1.3 \cdot 10^{-11}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (- (- (log y)) t)) (t_2 (* (+ x -1.0) (log y))))
   (if (<= t -48000000.0)
     t_1
     (if (<= t 4.5e-55)
       t_2
       (if (<= t 2e-34)
         (- (* y (- 1.0 z)) (log y))
         (if (<= t 1.3e-11) t_2 t_1))))))
double code(double x, double y, double z, double t) {
	double t_1 = -log(y) - t;
	double t_2 = (x + -1.0) * log(y);
	double tmp;
	if (t <= -48000000.0) {
		tmp = t_1;
	} else if (t <= 4.5e-55) {
		tmp = t_2;
	} else if (t <= 2e-34) {
		tmp = (y * (1.0 - z)) - log(y);
	} else if (t <= 1.3e-11) {
		tmp = t_2;
	} 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) :: t_2
    real(8) :: tmp
    t_1 = -log(y) - t
    t_2 = (x + (-1.0d0)) * log(y)
    if (t <= (-48000000.0d0)) then
        tmp = t_1
    else if (t <= 4.5d-55) then
        tmp = t_2
    else if (t <= 2d-34) then
        tmp = (y * (1.0d0 - z)) - log(y)
    else if (t <= 1.3d-11) then
        tmp = t_2
    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 = -Math.log(y) - t;
	double t_2 = (x + -1.0) * Math.log(y);
	double tmp;
	if (t <= -48000000.0) {
		tmp = t_1;
	} else if (t <= 4.5e-55) {
		tmp = t_2;
	} else if (t <= 2e-34) {
		tmp = (y * (1.0 - z)) - Math.log(y);
	} else if (t <= 1.3e-11) {
		tmp = t_2;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = -math.log(y) - t
	t_2 = (x + -1.0) * math.log(y)
	tmp = 0
	if t <= -48000000.0:
		tmp = t_1
	elif t <= 4.5e-55:
		tmp = t_2
	elif t <= 2e-34:
		tmp = (y * (1.0 - z)) - math.log(y)
	elif t <= 1.3e-11:
		tmp = t_2
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(-log(y)) - t)
	t_2 = Float64(Float64(x + -1.0) * log(y))
	tmp = 0.0
	if (t <= -48000000.0)
		tmp = t_1;
	elseif (t <= 4.5e-55)
		tmp = t_2;
	elseif (t <= 2e-34)
		tmp = Float64(Float64(y * Float64(1.0 - z)) - log(y));
	elseif (t <= 1.3e-11)
		tmp = t_2;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = -log(y) - t;
	t_2 = (x + -1.0) * log(y);
	tmp = 0.0;
	if (t <= -48000000.0)
		tmp = t_1;
	elseif (t <= 4.5e-55)
		tmp = t_2;
	elseif (t <= 2e-34)
		tmp = (y * (1.0 - z)) - log(y);
	elseif (t <= 1.3e-11)
		tmp = t_2;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[((-N[Log[y], $MachinePrecision]) - t), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -48000000.0], t$95$1, If[LessEqual[t, 4.5e-55], t$95$2, If[LessEqual[t, 2e-34], N[(N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision] - N[Log[y], $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.3e-11], t$95$2, t$95$1]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left(-\log y\right) - t\\
t_2 := \left(x + -1\right) \cdot \log y\\
\mathbf{if}\;t \leq -48000000:\\
\;\;\;\;t_1\\

\mathbf{elif}\;t \leq 4.5 \cdot 10^{-55}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;t \leq 2 \cdot 10^{-34}:\\
\;\;\;\;y \cdot \left(1 - z\right) - \log y\\

\mathbf{elif}\;t \leq 1.3 \cdot 10^{-11}:\\
\;\;\;\;t_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -4.8e7 or 1.3e-11 < t

    1. Initial program 95.1%

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

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

      \[\leadsto \color{blue}{-1 \cdot \log y} - t \]
    4. Step-by-step derivation
      1. mul-1-neg76.7%

        \[\leadsto \color{blue}{\left(-\log y\right)} - t \]
    5. Simplified76.7%

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

    if -4.8e7 < t < 4.4999999999999997e-55 or 1.99999999999999986e-34 < t < 1.3e-11

    1. Initial program 85.9%

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

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

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

    if 4.4999999999999997e-55 < t < 1.99999999999999986e-34

    1. Initial program 35.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. associate--l+35.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \mathsf{fma}\left(\log y, \color{blue}{0 - \left(x - 1\right)}, t\right) \]
      16. associate--r-100.0%

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

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

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

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

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

      \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \color{blue}{\left(t + \log y\right)} \]
    5. Step-by-step derivation
      1. +-commutative89.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -48000000:\\ \;\;\;\;\left(-\log y\right) - t\\ \mathbf{elif}\;t \leq 4.5 \cdot 10^{-55}:\\ \;\;\;\;\left(x + -1\right) \cdot \log y\\ \mathbf{elif}\;t \leq 2 \cdot 10^{-34}:\\ \;\;\;\;y \cdot \left(1 - z\right) - \log y\\ \mathbf{elif}\;t \leq 1.3 \cdot 10^{-11}:\\ \;\;\;\;\left(x + -1\right) \cdot \log y\\ \mathbf{else}:\\ \;\;\;\;\left(-\log y\right) - t\\ \end{array} \]

Alternative 7: 99.2% accurate, 1.9× speedup?

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

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

    \[\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. associate--l+88.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \color{blue}{\mathsf{fma}\left(\log y, -\left(x - 1\right), t\right)} \]
    15. neg-sub099.9%

      \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \mathsf{fma}\left(\log y, \color{blue}{0 - \left(x - 1\right)}, t\right) \]
    16. associate--r-99.9%

      \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \mathsf{fma}\left(\log y, \color{blue}{\left(0 - x\right) + 1}, t\right) \]
    17. neg-sub099.9%

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

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

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

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

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

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

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

Alternative 8: 89.1% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.2 \cdot 10^{+189} \lor \neg \left(z \leq 1.22 \cdot 10^{+154}\right):\\
\;\;\;\;\mathsf{log1p}\left(-y\right) \cdot \left(z - 1\right) - t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.2e189 or 1.22e154 < z

    1. Initial program 57.5%

      \[\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. associate--l+57.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \color{blue}{\mathsf{fma}\left(\log y, -\left(x - 1\right), t\right)} \]
      15. neg-sub099.9%

        \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \mathsf{fma}\left(\log y, \color{blue}{0 - \left(x - 1\right)}, t\right) \]
      16. associate--r-99.9%

        \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \mathsf{fma}\left(\log y, \color{blue}{\left(0 - x\right) + 1}, t\right) \]
      17. neg-sub099.9%

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

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

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

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

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

    if -1.2e189 < z < 1.22e154

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.2 \cdot 10^{+189} \lor \neg \left(z \leq 1.22 \cdot 10^{+154}\right):\\ \;\;\;\;\mathsf{log1p}\left(-y\right) \cdot \left(z - 1\right) - t\\ \mathbf{else}:\\ \;\;\;\;\left(x + -1\right) \cdot \log y - t\\ \end{array} \]

Alternative 9: 75.1% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \log y\\ \mathbf{if}\;x \leq -2.5 \cdot 10^{+18}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 7.5:\\ \;\;\;\;\left(-\log y\right) - t\\ \mathbf{elif}\;x \leq 3.6 \cdot 10^{+31} \lor \neg \left(x \leq 7.8 \cdot 10^{+124}\right):\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;-t\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (log y))))
   (if (<= x -2.5e+18)
     t_1
     (if (<= x 7.5)
       (- (- (log y)) t)
       (if (or (<= x 3.6e+31) (not (<= x 7.8e+124))) t_1 (- t))))))
double code(double x, double y, double z, double t) {
	double t_1 = x * log(y);
	double tmp;
	if (x <= -2.5e+18) {
		tmp = t_1;
	} else if (x <= 7.5) {
		tmp = -log(y) - t;
	} else if ((x <= 3.6e+31) || !(x <= 7.8e+124)) {
		tmp = t_1;
	} else {
		tmp = -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) :: t_1
    real(8) :: tmp
    t_1 = x * log(y)
    if (x <= (-2.5d+18)) then
        tmp = t_1
    else if (x <= 7.5d0) then
        tmp = -log(y) - t
    else if ((x <= 3.6d+31) .or. (.not. (x <= 7.8d+124))) then
        tmp = t_1
    else
        tmp = -t
    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 <= -2.5e+18) {
		tmp = t_1;
	} else if (x <= 7.5) {
		tmp = -Math.log(y) - t;
	} else if ((x <= 3.6e+31) || !(x <= 7.8e+124)) {
		tmp = t_1;
	} else {
		tmp = -t;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * math.log(y)
	tmp = 0
	if x <= -2.5e+18:
		tmp = t_1
	elif x <= 7.5:
		tmp = -math.log(y) - t
	elif (x <= 3.6e+31) or not (x <= 7.8e+124):
		tmp = t_1
	else:
		tmp = -t
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * log(y))
	tmp = 0.0
	if (x <= -2.5e+18)
		tmp = t_1;
	elseif (x <= 7.5)
		tmp = Float64(Float64(-log(y)) - t);
	elseif ((x <= 3.6e+31) || !(x <= 7.8e+124))
		tmp = t_1;
	else
		tmp = Float64(-t);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x * log(y);
	tmp = 0.0;
	if (x <= -2.5e+18)
		tmp = t_1;
	elseif (x <= 7.5)
		tmp = -log(y) - t;
	elseif ((x <= 3.6e+31) || ~((x <= 7.8e+124)))
		tmp = t_1;
	else
		tmp = -t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.5e+18], t$95$1, If[LessEqual[x, 7.5], N[((-N[Log[y], $MachinePrecision]) - t), $MachinePrecision], If[Or[LessEqual[x, 3.6e+31], N[Not[LessEqual[x, 7.8e+124]], $MachinePrecision]], t$95$1, (-t)]]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq 7.5:\\
\;\;\;\;\left(-\log y\right) - t\\

\mathbf{elif}\;x \leq 3.6 \cdot 10^{+31} \lor \neg \left(x \leq 7.8 \cdot 10^{+124}\right):\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -2.5e18 or 7.5 < x < 3.59999999999999996e31 or 7.8000000000000001e124 < x

    1. Initial program 94.6%

      \[\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. associate--l+94.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \mathsf{fma}\left(\log y, \color{blue}{0 - \left(x - 1\right)}, t\right) \]
      16. associate--r-99.8%

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

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

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

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

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

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

    if -2.5e18 < x < 7.5

    1. Initial program 84.2%

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

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

      \[\leadsto \color{blue}{-1 \cdot \log y} - t \]
    4. Step-by-step derivation
      1. mul-1-neg81.0%

        \[\leadsto \color{blue}{\left(-\log y\right)} - t \]
    5. Simplified81.0%

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

    if 3.59999999999999996e31 < x < 7.8000000000000001e124

    1. Initial program 87.2%

      \[\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. associate--l+87.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \color{blue}{\mathsf{fma}\left(\log y, -\left(x - 1\right), t\right)} \]
      15. neg-sub099.9%

        \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \mathsf{fma}\left(\log y, \color{blue}{0 - \left(x - 1\right)}, t\right) \]
      16. associate--r-99.9%

        \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \mathsf{fma}\left(\log y, \color{blue}{\left(0 - x\right) + 1}, t\right) \]
      17. neg-sub099.9%

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

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

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

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

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

        \[\leadsto \color{blue}{-t} \]
    6. Simplified57.8%

      \[\leadsto \color{blue}{-t} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification76.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.5 \cdot 10^{+18}:\\ \;\;\;\;x \cdot \log y\\ \mathbf{elif}\;x \leq 7.5:\\ \;\;\;\;\left(-\log y\right) - t\\ \mathbf{elif}\;x \leq 3.6 \cdot 10^{+31} \lor \neg \left(x \leq 7.8 \cdot 10^{+124}\right):\\ \;\;\;\;x \cdot \log y\\ \mathbf{else}:\\ \;\;\;\;-t\\ \end{array} \]

Alternative 10: 57.9% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \log y\\ \mathbf{if}\;t \leq -38000000000:\\ \;\;\;\;-t\\ \mathbf{elif}\;t \leq 4.8 \cdot 10^{-55}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 6.4 \cdot 10^{-34}:\\ \;\;\;\;y \cdot \left(1 - z\right)\\ \mathbf{elif}\;t \leq 1.8 \cdot 10^{+40}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;-t\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (log y))))
   (if (<= t -38000000000.0)
     (- t)
     (if (<= t 4.8e-55)
       t_1
       (if (<= t 6.4e-34) (* y (- 1.0 z)) (if (<= t 1.8e+40) t_1 (- t)))))))
double code(double x, double y, double z, double t) {
	double t_1 = x * log(y);
	double tmp;
	if (t <= -38000000000.0) {
		tmp = -t;
	} else if (t <= 4.8e-55) {
		tmp = t_1;
	} else if (t <= 6.4e-34) {
		tmp = y * (1.0 - z);
	} else if (t <= 1.8e+40) {
		tmp = t_1;
	} else {
		tmp = -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) :: t_1
    real(8) :: tmp
    t_1 = x * log(y)
    if (t <= (-38000000000.0d0)) then
        tmp = -t
    else if (t <= 4.8d-55) then
        tmp = t_1
    else if (t <= 6.4d-34) then
        tmp = y * (1.0d0 - z)
    else if (t <= 1.8d+40) then
        tmp = t_1
    else
        tmp = -t
    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 (t <= -38000000000.0) {
		tmp = -t;
	} else if (t <= 4.8e-55) {
		tmp = t_1;
	} else if (t <= 6.4e-34) {
		tmp = y * (1.0 - z);
	} else if (t <= 1.8e+40) {
		tmp = t_1;
	} else {
		tmp = -t;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * math.log(y)
	tmp = 0
	if t <= -38000000000.0:
		tmp = -t
	elif t <= 4.8e-55:
		tmp = t_1
	elif t <= 6.4e-34:
		tmp = y * (1.0 - z)
	elif t <= 1.8e+40:
		tmp = t_1
	else:
		tmp = -t
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * log(y))
	tmp = 0.0
	if (t <= -38000000000.0)
		tmp = Float64(-t);
	elseif (t <= 4.8e-55)
		tmp = t_1;
	elseif (t <= 6.4e-34)
		tmp = Float64(y * Float64(1.0 - z));
	elseif (t <= 1.8e+40)
		tmp = t_1;
	else
		tmp = Float64(-t);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x * log(y);
	tmp = 0.0;
	if (t <= -38000000000.0)
		tmp = -t;
	elseif (t <= 4.8e-55)
		tmp = t_1;
	elseif (t <= 6.4e-34)
		tmp = y * (1.0 - z);
	elseif (t <= 1.8e+40)
		tmp = t_1;
	else
		tmp = -t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -38000000000.0], (-t), If[LessEqual[t, 4.8e-55], t$95$1, If[LessEqual[t, 6.4e-34], N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.8e+40], t$95$1, (-t)]]]]]
\begin{array}{l}

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

\mathbf{elif}\;t \leq 4.8 \cdot 10^{-55}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;t \leq 1.8 \cdot 10^{+40}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -3.8e10 or 1.79999999999999998e40 < t

    1. Initial program 95.5%

      \[\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. associate--l+95.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \color{blue}{\mathsf{fma}\left(\log y, -\left(x - 1\right), t\right)} \]
      15. neg-sub099.9%

        \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \mathsf{fma}\left(\log y, \color{blue}{0 - \left(x - 1\right)}, t\right) \]
      16. associate--r-99.9%

        \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \mathsf{fma}\left(\log y, \color{blue}{\left(0 - x\right) + 1}, t\right) \]
      17. neg-sub099.9%

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

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

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

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

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

        \[\leadsto \color{blue}{-t} \]
    6. Simplified77.9%

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

    if -3.8e10 < t < 4.79999999999999983e-55 or 6.40000000000000005e-34 < t < 1.79999999999999998e40

    1. Initial program 86.2%

      \[\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. associate--l+86.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \mathsf{fma}\left(\log y, \color{blue}{0 - \left(x - 1\right)}, t\right) \]
      16. associate--r-99.8%

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

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

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

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

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

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

    if 4.79999999999999983e-55 < t < 6.40000000000000005e-34

    1. Initial program 42.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. associate--l+42.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \mathsf{fma}\left(\log y, \color{blue}{0 - \left(x - 1\right)}, t\right) \]
      16. associate--r-100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -38000000000:\\ \;\;\;\;-t\\ \mathbf{elif}\;t \leq 4.8 \cdot 10^{-55}:\\ \;\;\;\;x \cdot \log y\\ \mathbf{elif}\;t \leq 6.4 \cdot 10^{-34}:\\ \;\;\;\;y \cdot \left(1 - z\right)\\ \mathbf{elif}\;t \leq 1.8 \cdot 10^{+40}:\\ \;\;\;\;x \cdot \log y\\ \mathbf{else}:\\ \;\;\;\;-t\\ \end{array} \]

Alternative 11: 76.4% accurate, 2.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -7000000 \lor \neg \left(t \leq 1.3 \cdot 10^{-11}\right):\\
\;\;\;\;\left(-\log y\right) - t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -7e6 or 1.3e-11 < t

    1. Initial program 95.1%

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

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

      \[\leadsto \color{blue}{-1 \cdot \log y} - t \]
    4. Step-by-step derivation
      1. mul-1-neg76.7%

        \[\leadsto \color{blue}{\left(-\log y\right)} - t \]
    5. Simplified76.7%

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

    if -7e6 < t < 1.3e-11

    1. Initial program 82.5%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -7000000 \lor \neg \left(t \leq 1.3 \cdot 10^{-11}\right):\\ \;\;\;\;\left(-\log y\right) - t\\ \mathbf{else}:\\ \;\;\;\;\left(x + -1\right) \cdot \log y\\ \end{array} \]

Alternative 12: 88.6% accurate, 2.0× speedup?

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

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

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

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

    \[\leadsto \left(x + -1\right) \cdot \log y - t \]

Alternative 13: 43.6% accurate, 23.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -1000000000:\\ \;\;\;\;-t\\ \mathbf{elif}\;t \leq 600:\\ \;\;\;\;y \cdot \left(1 - z\right)\\ \mathbf{else}:\\ \;\;\;\;-t\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= t -1000000000.0) (- t) (if (<= t 600.0) (* y (- 1.0 z)) (- t))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (t <= -1000000000.0) {
		tmp = -t;
	} else if (t <= 600.0) {
		tmp = y * (1.0 - z);
	} else {
		tmp = -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 (t <= (-1000000000.0d0)) then
        tmp = -t
    else if (t <= 600.0d0) then
        tmp = y * (1.0d0 - z)
    else
        tmp = -t
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (t <= -1000000000.0) {
		tmp = -t;
	} else if (t <= 600.0) {
		tmp = y * (1.0 - z);
	} else {
		tmp = -t;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if t <= -1000000000.0:
		tmp = -t
	elif t <= 600.0:
		tmp = y * (1.0 - z)
	else:
		tmp = -t
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (t <= -1000000000.0)
		tmp = Float64(-t);
	elseif (t <= 600.0)
		tmp = Float64(y * Float64(1.0 - z));
	else
		tmp = Float64(-t);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (t <= -1000000000.0)
		tmp = -t;
	elseif (t <= 600.0)
		tmp = y * (1.0 - z);
	else
		tmp = -t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[t, -1000000000.0], (-t), If[LessEqual[t, 600.0], N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision], (-t)]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;t \leq -1000000000:\\
\;\;\;\;-t\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1e9 or 600 < t

    1. Initial program 95.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. associate--l+95.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \color{blue}{\mathsf{fma}\left(\log y, -\left(x - 1\right), t\right)} \]
      15. neg-sub099.9%

        \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \mathsf{fma}\left(\log y, \color{blue}{0 - \left(x - 1\right)}, t\right) \]
      16. associate--r-99.9%

        \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \mathsf{fma}\left(\log y, \color{blue}{\left(0 - x\right) + 1}, t\right) \]
      17. neg-sub099.9%

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

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

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

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

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

        \[\leadsto \color{blue}{-t} \]
    6. Simplified74.8%

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

    if -1e9 < t < 600

    1. Initial program 82.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. associate--l+82.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \color{blue}{\mathsf{fma}\left(\log y, -\left(x - 1\right), t\right)} \]
      15. neg-sub099.9%

        \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \mathsf{fma}\left(\log y, \color{blue}{0 - \left(x - 1\right)}, t\right) \]
      16. associate--r-99.9%

        \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \mathsf{fma}\left(\log y, \color{blue}{\left(0 - x\right) + 1}, t\right) \]
      17. neg-sub099.9%

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

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

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

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

      \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \color{blue}{\left(t + \log y\right)} \]
    5. Step-by-step derivation
      1. +-commutative57.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1000000000:\\ \;\;\;\;-t\\ \mathbf{elif}\;t \leq 600:\\ \;\;\;\;y \cdot \left(1 - z\right)\\ \mathbf{else}:\\ \;\;\;\;-t\\ \end{array} \]

Alternative 14: 43.3% accurate, 26.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -4100000000:\\
\;\;\;\;-t\\

\mathbf{elif}\;t \leq 510:\\
\;\;\;\;z \cdot \left(-y\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -4.1e9 or 510 < t

    1. Initial program 95.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. associate--l+95.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \color{blue}{\mathsf{fma}\left(\log y, -\left(x - 1\right), t\right)} \]
      15. neg-sub099.9%

        \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \mathsf{fma}\left(\log y, \color{blue}{0 - \left(x - 1\right)}, t\right) \]
      16. associate--r-99.9%

        \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \mathsf{fma}\left(\log y, \color{blue}{\left(0 - x\right) + 1}, t\right) \]
      17. neg-sub099.9%

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

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

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

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

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

        \[\leadsto \color{blue}{-t} \]
    6. Simplified74.8%

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

    if -4.1e9 < t < 510

    1. Initial program 82.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. associate--l+82.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \color{blue}{\mathsf{fma}\left(\log y, -\left(x - 1\right), t\right)} \]
      15. neg-sub099.9%

        \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \mathsf{fma}\left(\log y, \color{blue}{0 - \left(x - 1\right)}, t\right) \]
      16. associate--r-99.9%

        \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \mathsf{fma}\left(\log y, \color{blue}{\left(0 - x\right) + 1}, t\right) \]
      17. neg-sub099.9%

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

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

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

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

      \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \color{blue}{\left(t + \log y\right)} \]
    5. Step-by-step derivation
      1. +-commutative57.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-y \cdot z} \]
      2. *-commutative19.6%

        \[\leadsto -\color{blue}{z \cdot y} \]
      3. distribute-rgt-neg-in19.6%

        \[\leadsto \color{blue}{z \cdot \left(-y\right)} \]
    12. Simplified19.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -4100000000:\\ \;\;\;\;-t\\ \mathbf{elif}\;t \leq 510:\\ \;\;\;\;z \cdot \left(-y\right)\\ \mathbf{else}:\\ \;\;\;\;-t\\ \end{array} \]

Alternative 15: 36.2% 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.5%

    \[\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. associate--l+88.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \color{blue}{\mathsf{fma}\left(\log y, -\left(x - 1\right), t\right)} \]
    15. neg-sub099.9%

      \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \mathsf{fma}\left(\log y, \color{blue}{0 - \left(x - 1\right)}, t\right) \]
    16. associate--r-99.9%

      \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \mathsf{fma}\left(\log y, \color{blue}{\left(0 - x\right) + 1}, t\right) \]
    17. neg-sub099.9%

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

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

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

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

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

      \[\leadsto \color{blue}{-t} \]
  6. Simplified36.4%

    \[\leadsto \color{blue}{-t} \]
  7. Final simplification36.4%

    \[\leadsto -t \]

Alternative 16: 2.8% accurate, 215.0× speedup?

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

\\
y
\end{array}
Derivation
  1. Initial program 88.5%

    \[\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. associate--l+88.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \color{blue}{\mathsf{fma}\left(\log y, -\left(x - 1\right), t\right)} \]
    15. neg-sub099.9%

      \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \mathsf{fma}\left(\log y, \color{blue}{0 - \left(x - 1\right)}, t\right) \]
    16. associate--r-99.9%

      \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \mathsf{fma}\left(\log y, \color{blue}{\left(0 - x\right) + 1}, t\right) \]
    17. neg-sub099.9%

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

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

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

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

    \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \color{blue}{\left(t + \log y\right)} \]
  5. Step-by-step derivation
    1. +-commutative68.8%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{y} - \left(\log y + t\right) \]
  11. Taylor expanded in y around inf 3.0%

    \[\leadsto \color{blue}{y} \]
  12. Final simplification3.0%

    \[\leadsto y \]

Reproduce

?
herbie shell --seed 2023200 
(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))