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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 99.5% accurate, 1.0× speedup?

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

\\
\left(z \cdot \mathsf{log1p}\left(-y\right) + \log y \cdot \left(-1 + x\right)\right) - t
\end{array}
Derivation
  1. Initial program 87.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 z around inf 87.7%

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

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

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

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

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

Alternative 3: 99.2% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\log y \cdot \left(-1 + x\right) - y \cdot \left(z + \color{blue}{-1}\right)\right) - t \]
    14. +-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(y \cdot \left(1 - z\right) + \log y \cdot \left(x - 1\right)\right)} - t \]
  6. Step-by-step derivation
    1. fma-def99.6%

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

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

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

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

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

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

Alternative 4: 87.6% accurate, 1.9× speedup?

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

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

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


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

    1. Initial program 87.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 87.9%

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

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

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

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

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

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

    1. Initial program 71.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 85.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 89.6% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -6 \cdot 10^{+176} \lor \neg \left(z \leq 7.8 \cdot 10^{+258}\right):\\
\;\;\;\;z \cdot \left(-y\right) - t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -6e176 or 7.80000000000000074e258 < z

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\log y \cdot \left(-1 + x\right) - y \cdot \left(z + \color{blue}{-1}\right)\right) - t \]
      14. +-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 z around inf 86.2%

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

        \[\leadsto \color{blue}{\left(-y \cdot z\right)} - t \]
      2. distribute-rgt-neg-in86.2%

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

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

    if -6e176 < z < 7.80000000000000074e258

    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 z around inf 94.6%

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

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

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

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

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

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

Alternative 6: 99.0% accurate, 1.9× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 78.3% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -45000000000 \lor \neg \left(x \leq 300\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 -45000000000.0) (not (<= x 300.0)))
   (- (* x (log y)) t)
   (- (* z (log1p (- y))) t)))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((x <= -45000000000.0) || !(x <= 300.0)) {
		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 <= -45000000000.0) || !(x <= 300.0)) {
		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 <= -45000000000.0) or not (x <= 300.0):
		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 <= -45000000000.0) || !(x <= 300.0))
		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, -45000000000.0], N[Not[LessEqual[x, 300.0]], $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 -45000000000 \lor \neg \left(x \leq 300\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 < -4.5e10 or 300 < x

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

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

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

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

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

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

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

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

    if -4.5e10 < x < 300

    1. Initial program 82.9%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 78.1% accurate, 2.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -28500000000 \lor \neg \left(x \leq 90\right):\\
\;\;\;\;x \cdot \log y - t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.85e10 or 90 < x

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

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

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

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

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

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

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

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

    if -2.85e10 < x < 90

    1. Initial program 82.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\log y \cdot \left(-1 + x\right) - y \cdot \left(z + \color{blue}{-1}\right)\right) - t \]
      14. +-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 inf 63.4%

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

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

Alternative 9: 43.7% accurate, 26.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.8 \cdot 10^{-5} \lor \neg \left(t \leq 2.6 \cdot 10^{+14}\right):\\
\;\;\;\;-t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -3.8000000000000002e-5 or 2.6e14 < t

    1. Initial program 97.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.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\log y \cdot \left(-1 + x\right) - y \cdot \left(z + \color{blue}{-1}\right)\right) - t \]
      14. +-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 z around inf 76.3%

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

        \[\leadsto \color{blue}{\left(-y \cdot z\right)} - t \]
      2. distribute-rgt-neg-in76.3%

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

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

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

        \[\leadsto \color{blue}{-t} \]
    10. Simplified73.4%

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

    if -3.8000000000000002e-5 < t < 2.6e14

    1. Initial program 78.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.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-y \cdot z\right)} - t \]
      2. distribute-rgt-neg-in22.9%

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

      \[\leadsto \color{blue}{y \cdot \left(-z\right)} - t \]
    8. Taylor expanded in y around inf 22.6%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -3.8 \cdot 10^{-5} \lor \neg \left(t \leq 2.6 \cdot 10^{+14}\right):\\ \;\;\;\;-t\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(-y\right)\\ \end{array} \]

Alternative 10: 47.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 87.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.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\log y \cdot \left(-1 + x\right) - y \cdot \left(z + \color{blue}{-1}\right)\right) - t \]
    14. +-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 inf 49.4%

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

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

Alternative 11: 46.8% accurate, 35.8× speedup?

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

\\
z \cdot \left(-y\right) - t
\end{array}
Derivation
  1. Initial program 87.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.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\log y \cdot \left(-1 + x\right) - y \cdot \left(z + \color{blue}{-1}\right)\right) - t \]
    14. +-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 z around inf 49.2%

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

      \[\leadsto \color{blue}{\left(-y \cdot z\right)} - t \]
    2. distribute-rgt-neg-in49.2%

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

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

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

Alternative 12: 36.0% 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.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.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\log y \cdot \left(-1 + x\right) - y \cdot \left(z + \color{blue}{-1}\right)\right) - t \]
    14. +-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 z around inf 49.2%

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

      \[\leadsto \color{blue}{\left(-y \cdot z\right)} - t \]
    2. distribute-rgt-neg-in49.2%

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

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

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

      \[\leadsto \color{blue}{-t} \]
  10. Simplified37.8%

    \[\leadsto \color{blue}{-t} \]
  11. Final simplification37.8%

    \[\leadsto -t \]

Reproduce

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