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

Percentage Accurate: 89.0% → 99.8%
Time: 18.5s
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.0% 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 90.9%

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

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

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

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

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

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

\\
\left(\left(y \cdot \left(y \cdot -0.5\right) - y\right) \cdot \left(z + -1\right) + \left(x + -1\right) \cdot \log y\right) - t
\end{array}
Derivation
  1. Initial program 90.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 99.2%

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

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

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

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

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

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

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

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

Alternative 3: 87.7% accurate, 1.8× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;x \cdot \log y - t\\


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

    1. Initial program 90.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 88.2%

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

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

    1. Initial program 50.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 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. sub-neg100.0%

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

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

        \[\leadsto \left(\log y \cdot \left(-1 + x\right) - \color{blue}{y \cdot \left(z + -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 0 66.1%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(-1, \log y, -\left(z - 1\right) \cdot y\right)} - t \]
      2. *-lft-identity66.1%

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

        \[\leadsto \mathsf{fma}\left(-1, \color{blue}{{1}^{0.3333333333333333}} \cdot \log y, -\left(z - 1\right) \cdot y\right) - t \]
      4. mul-1-neg66.1%

        \[\leadsto \mathsf{fma}\left(-1, {1}^{0.3333333333333333} \cdot \log y, \color{blue}{-1 \cdot \left(\left(z - 1\right) \cdot y\right)}\right) - t \]
      5. fma-def66.1%

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

        \[\leadsto \color{blue}{\left(-1 \cdot \left(\left(z - 1\right) \cdot y\right) + -1 \cdot \left({1}^{0.3333333333333333} \cdot \log y\right)\right)} - t \]
      7. pow-base-166.1%

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

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

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

        \[\leadsto \color{blue}{\left(-1 \cdot \left(\left(z - 1\right) \cdot y\right) - \log y\right)} - t \]
      11. associate-*r*66.1%

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

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

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

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

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

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

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

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

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

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

    if 1 < (-.f64 x 1)

    1. Initial program 93.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.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. sub-neg99.6%

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

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

        \[\leadsto \left(\log y \cdot \left(-1 + x\right) - \color{blue}{y \cdot \left(z + -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 y around 0 99.6%

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

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

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

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

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

      \[\leadsto \color{blue}{\log y \cdot x} - t \]
  3. Recombined 3 regimes into one program.
  4. Final simplification89.3%

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

Alternative 4: 99.1% 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 90.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 98.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. +-commutative98.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-neg98.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-eval98.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-neg98.9%

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

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

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

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

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

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

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

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

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

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

Alternative 5: 99.0% accurate, 1.9× speedup?

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

\\
\left(\left(x + -1\right) \cdot \log y - y \cdot z\right) - t
\end{array}
Derivation
  1. Initial program 90.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 98.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. +-commutative98.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-neg98.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-eval98.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-neg98.9%

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 76.1% accurate, 2.0× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -6.8000000000000002e-96 or 5.5 < x

    1. Initial program 95.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -6.8000000000000002e-96 < x < 5.5

    1. Initial program 82.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 z around inf 47.2%

      \[\leadsto \color{blue}{z \cdot \log \left(1 - y\right)} - t \]
    3. Step-by-step derivation
      1. sub-neg47.2%

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

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

        \[\leadsto z \cdot \color{blue}{\mathsf{log1p}\left(-1 \cdot y\right)} - t \]
      4. mul-1-neg63.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -6.8 \cdot 10^{-96} \lor \neg \left(x \leq 5.5\right):\\ \;\;\;\;x \cdot \log y - t\\ \mathbf{else}:\\ \;\;\;\;z \cdot \mathsf{log1p}\left(-y\right) - t\\ \end{array} \]

Alternative 7: 76.0% accurate, 2.0× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -6.8000000000000002e-96 or 1650 < x

    1. Initial program 95.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -6.8000000000000002e-96 < x < 1650

    1. Initial program 82.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 z around inf 47.2%

      \[\leadsto \color{blue}{z \cdot \log \left(1 - y\right)} - t \]
    3. Step-by-step derivation
      1. sub-neg47.2%

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

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

        \[\leadsto z \cdot \color{blue}{\mathsf{log1p}\left(-1 \cdot y\right)} - t \]
      4. mul-1-neg63.8%

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

      \[\leadsto \color{blue}{z \cdot \mathsf{log1p}\left(-y\right)} - t \]
    5. Taylor expanded in y around 0 62.5%

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

        \[\leadsto -0.5 \cdot \left({y}^{2} \cdot z\right) + \left(\color{blue}{\left(-t\right)} + -1 \cdot \left(y \cdot z\right)\right) \]
      2. associate-+r+62.5%

        \[\leadsto \color{blue}{\left(-0.5 \cdot \left({y}^{2} \cdot z\right) + \left(-t\right)\right) + -1 \cdot \left(y \cdot z\right)} \]
      3. mul-1-neg62.5%

        \[\leadsto \left(-0.5 \cdot \left({y}^{2} \cdot z\right) + \left(-t\right)\right) + \color{blue}{\left(-y \cdot z\right)} \]
      4. *-commutative62.5%

        \[\leadsto \left(-0.5 \cdot \left({y}^{2} \cdot z\right) + \left(-t\right)\right) + \left(-\color{blue}{z \cdot y}\right) \]
      5. unsub-neg62.5%

        \[\leadsto \color{blue}{\left(-0.5 \cdot \left({y}^{2} \cdot z\right) + \left(-t\right)\right) - z \cdot y} \]
      6. unsub-neg62.5%

        \[\leadsto \color{blue}{\left(-0.5 \cdot \left({y}^{2} \cdot z\right) - t\right)} - z \cdot y \]
      7. associate-*r*62.5%

        \[\leadsto \left(\color{blue}{\left(-0.5 \cdot {y}^{2}\right) \cdot z} - t\right) - z \cdot y \]
      8. unpow262.5%

        \[\leadsto \left(\left(-0.5 \cdot \color{blue}{\left(y \cdot y\right)}\right) \cdot z - t\right) - z \cdot y \]
      9. *-commutative62.5%

        \[\leadsto \left(\left(-0.5 \cdot \left(y \cdot y\right)\right) \cdot z - t\right) - \color{blue}{y \cdot z} \]
    7. Simplified62.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -6.8 \cdot 10^{-96} \lor \neg \left(x \leq 1650\right):\\ \;\;\;\;x \cdot \log y - t\\ \mathbf{else}:\\ \;\;\;\;\left(z \cdot \left(-0.5 \cdot \left(y \cdot y\right)\right) - t\right) - y \cdot z\\ \end{array} \]

Alternative 8: 88.8% accurate, 2.0× speedup?

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

    1. Initial program 44.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 z around inf 28.0%

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

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

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

        \[\leadsto z \cdot \color{blue}{\mathsf{log1p}\left(-1 \cdot y\right)} - t \]
      4. mul-1-neg83.2%

        \[\leadsto z \cdot \mathsf{log1p}\left(\color{blue}{-y}\right) - t \]
    4. Simplified83.2%

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

    if -4.60000000000000022e260 < z

    1. Initial program 93.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 91.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 -4.6 \cdot 10^{+260}:\\ \;\;\;\;z \cdot \mathsf{log1p}\left(-y\right) - t\\ \mathbf{else}:\\ \;\;\;\;\left(x + -1\right) \cdot \log y - t\\ \end{array} \]

Alternative 9: 46.1% accurate, 16.5× speedup?

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

\\
\left(z \cdot \left(-0.5 \cdot \left(y \cdot y\right)\right) - t\right) - y \cdot z
\end{array}
Derivation
  1. Initial program 90.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 z around inf 35.3%

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

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

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

      \[\leadsto z \cdot \color{blue}{\mathsf{log1p}\left(-1 \cdot y\right)} - t \]
    4. mul-1-neg43.7%

      \[\leadsto z \cdot \mathsf{log1p}\left(\color{blue}{-y}\right) - t \]
  4. Simplified43.7%

    \[\leadsto \color{blue}{z \cdot \mathsf{log1p}\left(-y\right)} - t \]
  5. Taylor expanded in y around 0 43.1%

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

      \[\leadsto -0.5 \cdot \left({y}^{2} \cdot z\right) + \left(\color{blue}{\left(-t\right)} + -1 \cdot \left(y \cdot z\right)\right) \]
    2. associate-+r+43.1%

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

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

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

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

      \[\leadsto \color{blue}{\left(-0.5 \cdot \left({y}^{2} \cdot z\right) - t\right)} - z \cdot y \]
    7. associate-*r*43.1%

      \[\leadsto \left(\color{blue}{\left(-0.5 \cdot {y}^{2}\right) \cdot z} - t\right) - z \cdot y \]
    8. unpow243.1%

      \[\leadsto \left(\left(-0.5 \cdot \color{blue}{\left(y \cdot y\right)}\right) \cdot z - t\right) - z \cdot y \]
    9. *-commutative43.1%

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

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

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

Alternative 10: 46.0% 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 90.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 98.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. +-commutative98.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-neg98.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-eval98.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-neg98.9%

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 45.8% accurate, 35.8× speedup?

\[\begin{array}{l} \\ \left(-y \cdot 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(-Float64(y * 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}

\\
\left(-y \cdot z\right) - t
\end{array}
Derivation
  1. Initial program 90.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 98.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. +-commutative98.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-neg98.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-eval98.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-neg98.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 35.1% accurate, 43.0× speedup?

\[\begin{array}{l} \\ y \cdot z - 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 * 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 z - t
\end{array}
Derivation
  1. Initial program 90.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 z around inf 35.3%

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

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

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

      \[\leadsto z \cdot \color{blue}{\mathsf{log1p}\left(-1 \cdot y\right)} - t \]
    4. mul-1-neg43.7%

      \[\leadsto z \cdot \mathsf{log1p}\left(\color{blue}{-y}\right) - t \]
  4. Simplified43.7%

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

      \[\leadsto \color{blue}{z \cdot \mathsf{log1p}\left(-y\right) + \left(-t\right)} \]
    2. add-sqr-sqrt0.0%

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

      \[\leadsto z \cdot \mathsf{log1p}\left(\color{blue}{\sqrt{\left(-y\right) \cdot \left(-y\right)}}\right) + \left(-t\right) \]
    4. sqr-neg33.6%

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

      \[\leadsto z \cdot \mathsf{log1p}\left(\color{blue}{\sqrt{y} \cdot \sqrt{y}}\right) + \left(-t\right) \]
    6. add-sqr-sqrt33.7%

      \[\leadsto z \cdot \mathsf{log1p}\left(\color{blue}{y}\right) + \left(-t\right) \]
  6. Applied egg-rr33.7%

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

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

    \[\leadsto \color{blue}{z \cdot \mathsf{log1p}\left(y\right) - t} \]
  9. Taylor expanded in y around 0 33.7%

    \[\leadsto \color{blue}{y \cdot z} - t \]
  10. Final simplification33.7%

    \[\leadsto y \cdot z - t \]

Alternative 13: 35.3% 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 90.9%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-t} \]
  6. Simplified33.7%

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

    \[\leadsto -t \]

Reproduce

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