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

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

\\
\mathsf{fma}\left(x + -1, \log y, \mathsf{log1p}\left(-y\right) \cdot \left(z + -1\right)\right) - t
\end{array}
Derivation
  1. Initial program 87.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. cancel-sign-sub87.6%

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(x - 1, \log y, -\left(-\left(z - 1\right) \cdot \log \left(1 - y\right)\right)\right)} - t \]
    4. remove-double-neg87.6%

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

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

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

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

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

Alternative 2: 99.4% accurate, 1.8× speedup?

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

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

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

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

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

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

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

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

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

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

Alternative 3: 97.9% accurate, 1.8× speedup?

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

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

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


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

    1. Initial program 92.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 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 83.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 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 95.5% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -1.65 \cdot 10^{+117} \lor \neg \left(z \leq 3.35 \cdot 10^{+140}\right):\\ \;\;\;\;\left(x \cdot \log y - y \cdot z\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.65e+117) (not (<= z 3.35e+140)))
   (- (- (* x (log y)) (* y z)) t)
   (- (* (+ x -1.0) (log y)) t)))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((z <= -1.65e+117) || !(z <= 3.35e+140)) {
		tmp = ((x * log(y)) - (y * z)) - 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
    real(8) :: tmp
    if ((z <= (-1.65d+117)) .or. (.not. (z <= 3.35d+140))) then
        tmp = ((x * log(y)) - (y * z)) - 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) {
	double tmp;
	if ((z <= -1.65e+117) || !(z <= 3.35e+140)) {
		tmp = ((x * Math.log(y)) - (y * z)) - t;
	} else {
		tmp = ((x + -1.0) * Math.log(y)) - t;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (z <= -1.65e+117) or not (z <= 3.35e+140):
		tmp = ((x * math.log(y)) - (y * z)) - t
	else:
		tmp = ((x + -1.0) * math.log(y)) - t
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((z <= -1.65e+117) || !(z <= 3.35e+140))
		tmp = Float64(Float64(Float64(x * log(y)) - Float64(y * z)) - t);
	else
		tmp = Float64(Float64(Float64(x + -1.0) * log(y)) - t);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((z <= -1.65e+117) || ~((z <= 3.35e+140)))
		tmp = ((x * log(y)) - (y * z)) - t;
	else
		tmp = ((x + -1.0) * log(y)) - t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.65e+117], N[Not[LessEqual[z, 3.35e+140]], $MachinePrecision]], N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - N[(y * z), $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.65 \cdot 10^{+117} \lor \neg \left(z \leq 3.35 \cdot 10^{+140}\right):\\
\;\;\;\;\left(x \cdot \log y - y \cdot z\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.6499999999999999e117 or 3.35e140 < z

    1. Initial program 64.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.6499999999999999e117 < z < 3.35e140

    1. Initial program 96.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 95.6%

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

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

Alternative 5: 99.0% accurate, 1.9× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 85.9% accurate, 1.9× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1 or 1.5e39 < 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. Taylor expanded in y around 0 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1 < x < 7.50000000000000041e-78

    1. Initial program 84.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. +-commutative84.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+84.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-def84.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-neg84.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. Taylor expanded in x around 0 98.5%

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

        \[\leadsto \mathsf{fma}\left(z - 1, \mathsf{log1p}\left(-y\right), \color{blue}{\left(-\log y\right)} - t\right) \]
    6. Simplified98.5%

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

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

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

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

        \[\leadsto \color{blue}{\left(-\log \left(1 - y\right)\right)} + \left(-\left(\log y + t\right)\right) \]
      4. distribute-neg-out82.8%

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

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

        \[\leadsto -\left(\color{blue}{\mathsf{log1p}\left(-y\right)} + \left(\log y + t\right)\right) \]
      7. +-commutative82.8%

        \[\leadsto -\left(\mathsf{log1p}\left(-y\right) + \color{blue}{\left(t + \log y\right)}\right) \]
    9. Simplified82.8%

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

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

    if 7.50000000000000041e-78 < x < 1.5e39

    1. Initial program 68.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 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 86.0% accurate, 1.9× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1 or 1.5e39 < 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. Taylor expanded in y around 0 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1 < x < 6.4999999999999999e-77

    1. Initial program 84.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. +-commutative84.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+84.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-def84.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-neg84.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. Taylor expanded in x around 0 98.5%

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

        \[\leadsto \mathsf{fma}\left(z - 1, \mathsf{log1p}\left(-y\right), \color{blue}{\left(-\log y\right)} - t\right) \]
    6. Simplified98.5%

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

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

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

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

        \[\leadsto \color{blue}{\left(-\log \left(1 - y\right)\right)} + \left(-\left(\log y + t\right)\right) \]
      4. distribute-neg-out82.8%

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

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

        \[\leadsto -\left(\color{blue}{\mathsf{log1p}\left(-y\right)} + \left(\log y + t\right)\right) \]
      7. +-commutative82.8%

        \[\leadsto -\left(\mathsf{log1p}\left(-y\right) + \color{blue}{\left(t + \log y\right)}\right) \]
    9. Simplified82.8%

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

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

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

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

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

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

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

    if 6.4999999999999999e-77 < x < 1.5e39

    1. Initial program 68.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 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 89.5% accurate, 2.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.95 \cdot 10^{+218}:\\
\;\;\;\;\left(x + -1\right) \cdot \log y - t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 1.9500000000000001e218

    1. Initial program 91.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 90.9%

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

    if 1.9500000000000001e218 < z

    1. Initial program 43.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 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 60.5% accurate, 2.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.1 \cdot 10^{+120} \lor \neg \left(z \leq 5.5 \cdot 10^{+141}\right):\\
\;\;\;\;y \cdot \left(-z\right) - t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -4.1e120 or 5.49999999999999967e141 < z

    1. Initial program 64.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.1e120 < z < 5.49999999999999967e141

    1. Initial program 96.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. +-commutative96.1%

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(z - 1, \mathsf{log1p}\left(-y\right), \color{blue}{\left(-\log y\right)} - t\right) \]
    6. Simplified63.5%

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

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

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

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

        \[\leadsto \color{blue}{\left(-\log \left(1 - y\right)\right)} + \left(-\left(\log y + t\right)\right) \]
      4. distribute-neg-out59.6%

        \[\leadsto \color{blue}{-\left(\log \left(1 - y\right) + \left(\log y + t\right)\right)} \]
      5. sub-neg59.6%

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

        \[\leadsto -\left(\color{blue}{\mathsf{log1p}\left(-y\right)} + \left(\log y + t\right)\right) \]
      7. +-commutative59.6%

        \[\leadsto -\left(\mathsf{log1p}\left(-y\right) + \color{blue}{\left(t + \log y\right)}\right) \]
    9. Simplified59.6%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -4.1 \cdot 10^{+120} \lor \neg \left(z \leq 5.5 \cdot 10^{+141}\right):\\ \;\;\;\;y \cdot \left(-z\right) - t\\ \mathbf{else}:\\ \;\;\;\;\left(-\log y\right) - t\\ \end{array} \]

Alternative 10: 54.9% accurate, 2.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -9.6 \cdot 10^{-69} \lor \neg \left(t \leq 2.8 \cdot 10^{-18}\right):\\
\;\;\;\;y \cdot \left(-z\right) - t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -9.6000000000000005e-69 or 2.80000000000000012e-18 < t

    1. Initial program 94.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 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.6000000000000005e-69 < t < 2.80000000000000012e-18

    1. Initial program 79.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. +-commutative79.0%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-\log \left(1 - y\right)\right)} + \left(-\left(\log y + t\right)\right) \]
      4. distribute-neg-out39.4%

        \[\leadsto \color{blue}{-\left(\log \left(1 - y\right) + \left(\log y + t\right)\right)} \]
      5. sub-neg39.4%

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

        \[\leadsto -\left(\color{blue}{\mathsf{log1p}\left(-y\right)} + \left(\log y + t\right)\right) \]
      7. +-commutative39.4%

        \[\leadsto -\left(\mathsf{log1p}\left(-y\right) + \color{blue}{\left(t + \log y\right)}\right) \]
    9. Simplified39.4%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -9.6 \cdot 10^{-69} \lor \neg \left(t \leq 2.8 \cdot 10^{-18}\right):\\ \;\;\;\;y \cdot \left(-z\right) - t\\ \mathbf{else}:\\ \;\;\;\;-\log y\\ \end{array} \]

Alternative 11: 45.5% accurate, 30.7× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 45.3% accurate, 35.8× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto y \cdot \left(-z\right) - t \]

Alternative 13: 35.4% 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 87.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. cancel-sign-sub87.6%

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(x - 1, \log y, -\left(-\left(z - 1\right) \cdot \log \left(1 - y\right)\right)\right)} - t \]
    4. remove-double-neg87.6%

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

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

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

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

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

      \[\leadsto \color{blue}{-t} \]
  6. Simplified37.2%

    \[\leadsto \color{blue}{-t} \]
  7. Final simplification37.2%

    \[\leadsto -t \]

Reproduce

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